Skip to content

Commit

Permalink
Exception parameters are intrinsically NonNull
Browse files Browse the repository at this point in the history
  • Loading branch information
wmdietl committed Apr 25, 2024
1 parent 8989d39 commit 4528a8f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ void catchParameters() {
// test:irrelevant-annotation:NonNull
} catch (@NonNull RuntimeException e) {
}
try {
} catch (RuntimeException e) {
// test:name:Intrinsically NonNull exception parameter cannot be assigned null
// test:cannot-convert:null? to RuntimeException
e = null;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ void catchParameters() {
// test:irrelevant-annotation:NonNull
} catch (@NonNull RuntimeException e) {
}
try {
} catch (RuntimeException e) {
// test:name:Intrinsically NonNull exception parameter cannot be assigned null
// test:cannot-convert:null? to RuntimeException
e = null;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ void catchParameters() {
// test:irrelevant-annotation:NonNull
} catch (@NonNull RuntimeException e) {
}
try {
} catch (RuntimeException e) {
// test:name:Intrinsically NonNull exception parameter cannot be assigned null
// test:cannot-convert:null? to RuntimeException
e = null;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ Additionally, any location above is unrecognized if it makes up *any
> for the exceptions defined by this section.
- a local variable type
- an exception parameter
- the type in a cast or `instanceof` expression
- an array or object creation expression (including via a member reference)
- an explicit type argument supplied to a generic method or constructor
Expand All @@ -303,6 +302,7 @@ All locations that are not explicitly listed as recognized are unrecognized.
>
> - supertype in a class declaration
> - thrown exception type
> - exception parameter type
> - enum constant declaration
> - receiver parameter type
>
Expand Down

0 comments on commit 4528a8f

Please sign in to comment.