// File1.java
class File1 {}
// File2.java
@org.jspecify.annotations.NullMarked
class File2 {
<T> T call(java.util.function.Supplier<T> s) { return s.get(); }
void f() {
call(() -> { return ""; });
call(() -> { return null; });
}
}
With the NullAway:WarnOnGenericInferenceFailure option, there is a confusing extra report pointing to the end of unrelated class File1:
File1.java:2: warning: [NullAway] inference failure: type variable T constrained to be both @NonNull and @Nullable
(see http://t.uber.com/nullaway )
File2.java:6: warning: [NullAway] inference failure: type variable T constrained to be both @NonNull and @Nullable
call(() -> { return null; });
^
(see http://t.uber.com/nullaway )
The first report happens via AccessPathNullnessPropagation, using a VisitorState from the first file of the compilation.
With the
NullAway:WarnOnGenericInferenceFailureoption, there is a confusing extra report pointing to the end of unrelated class File1:The first report happens via AccessPathNullnessPropagation, using a VisitorState from the first file of the compilation.