Closed ash211 closed 1 year ago
Type
Description
Released 3.5.0
fwiw, null causes allowed by the jdk aren't sufficient reason to allow null in our APIs, however in this case I think the convenience of matching broader norms outweigh the avoidance of nulls (plus, we tend to be more permissive around errors such that fewer things go wrong when things begin to go sideways)
Good point that JDK being null-accepting doesn't mean our exceptions must be as well. But being permissive in error scenarios makes sense too. Thanks for reviewing!
Before this PR
Baseline's nullaway plugin blocks calling these constructors with a
null
cause:But null causes are explicitly allowed in the JDK for this parameter:
https://github.com/openjdk/jdk/blob/46c4da7fddb8103934f2a90b4456a5ce6ed3467c/src/java.base/share/classes/java/lang/Exception.java#L79-L81
So we need to tell nullaway that this pattern is nullable, and the standard way to do that is with the
javax.annotation.Nullable
annotation.After this PR
==COMMIT_MSG== Add
@Nullable
annotations to exception causes ==COMMIT_MSG==