Skip to content

Say when the bound in a mismatch note comes from a library model #2204

Backlog

Description

@vlsi

Problem or use case

For result.addAll(list) with List<?> list and List<Object> result, #1828 prints:

note: the unbounded wildcard ? in List<?> has the upper bound of type parameter E of List, which is @Nullable Object (JLS 5.1.10)

That bound is declared by the JSpecify JDK model (or by a LibraryModels entry), not in any source the reader can open. A reader who looks up java.util.List finds E with no bound and cannot tell why NullAway treats it as nullable.

Example and expected behavior

Same code as above, JSpecify mode on. Where the bound of the named type parameter comes from a library model or from unannotated code, the note says so, for example:

note: the unbounded wildcard ? in List<?> has the upper bound of type parameter E of List, which is @Nullable Object as the JSpecify JDK model declares it (JLS 5.1.10)

Additional context

Raised in the review of #1828: #1828 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions