Skip to content

WarnOnGenericInferenceFailure redundantly reporting in wrong file #1725

Description

@jeffrey-easyesi
// 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.

Activity

  1. added a commit that references this issue on Aug 25, 2026
    f2015e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    highpriorityjspecifyRelated to support for jspecify standard (see jspecify.dev)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions