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
{{ message }}
Repository navigation
JSpecify mode: @Nullable on a type argument that has type arguments is not checked against the bound #2227
Found during differential testing, which uses the Lean framework and Specimen to generate well-typed programs and compares the verified Lean checker with NullAway.
A @Nullable type argument is checked against the bound of its type parameter only when it has no type arguments itself.
NullAway reports only the type argument in plainArgument:
Test.java:12: error: [NullAway] Generic type parameter cannot be @Nullable, as type variable T of type Test.Hasher does not have a @Nullable upper bound
It should report the same error in parameterizedArgument, because T has no @Nullable bound. That method throws a NullPointerException at run time.
The same happens for a field, parameter, superclass, bound or explicit method type argument, and for qualified names such as java.util.@Nullable List<String>. An annotated array, List<String> @Nullable [], is reported.
#1946 is the same check for a type variable as the argument.
NullAway 0.14.4 and master 1bf8910, Error Prone 2.53.0, JDK 26.0.1.
Thanks @aosen-xiong for this and #2228. We do still have many gaps in our JSpecify mode checking, as you can see from the number of open issues we have 😅 If you discover a lot more issues like this with your tools, it'd be best for us to sync separately on how best to track them. Submitting each of them as a separate issue might be overwhelming. But we do appreciate the reports!
Activity
msridhar commentedon Dec 2, 2026
Thanks @aosen-xiong for this and #2228. We do still have many gaps in our JSpecify mode checking, as you can see from the number of open issues we have 😅 If you discover a lot more issues like this with your tools, it'd be best for us to sync separately on how best to track them. Submitting each of them as a separate issue might be overwhelming. But we do appreciate the reports!