You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add some missing `@Nullable` annotations.
Most of these came to my attention during the testing of
[RedundantNullCheck](google/error-prone#5121).
Notes:
- For `BufferedInputStream` and `FilterInputStream`, see
#128.
- For `URL`, the docs for `getAuthority()` don't mention `null`, but
it's easy enough to demonstrate that `null` is a possible return
value:
```java
var u = new URL("mailto:foo@bar.com");
System.out.println("authority " + u.getAuthority());
```
- `AlgorithmParameters.toString()` is gross but documented as such, as
eamonnmcmanus points out.
- `Matcher.group()` is unfortunate: At one point, it could not return
`null`, but that changed, as documented since
[JDK-8274663](https://bugs.openjdk.org/browse/JDK-8274663). The change
is a consequence of
[`usePattern`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/regex/Matcher.html#usePattern(java.util.regex.Pattern)),
which was added all the way back in Java 5. I am a little tempted to
lie here and leave the type as non-null.
- In `Component`, I also removed an annotation on the package-private
helper method used by `getName()`.
- In `ResultSet`, `getBlob` and `getObject` have no documentation about
`null` returns. Gemini [wrote me some code that demonstrates the
possible null returns](https://g.co/gemini/share/776a7669ae47).
- Also in `ResultSet`, I simplified some type-parameter declarations.
This ensures that the `Class<T>` parameter has its type argument in
bounds, and it makes no difference to the result type, which is always
nullable, regardless of the type argument.
Fixes#128
0 commit comments