Skip to content

JSpecify: improve inference for generic methods based on method reference arguments#1438

Merged
msridhar merged 73 commits intomasterfrom
method-ref-generic-inference
Feb 16, 2026
Merged

JSpecify: improve inference for generic methods based on method reference arguments#1438
msridhar merged 73 commits intomasterfrom
method-ref-generic-inference

Conversation

@msridhar
Copy link
Copy Markdown
Collaborator

@msridhar msridhar commented Jan 19, 2026

We now integrate inference of types for method references passed to generic method calls as part of the overall inference process for generic method calls. Includes handling of method references to varargs methods (which has a surprising number of corner cases).

Summary by CodeRabbit

  • Bug Fixes

    • More precise nullability checks for method references (bound, unbound, static, non-static) with improved qualifier/type substitution and generic-argument handling, reducing incorrect parameter nullness reports in JSpecify mode.
    • Generic method references now participate in nullability inference, reducing false positives for generic method overrides invoked via method references.
  • Tests

    • Expanded and renamed tests covering bound/unbound/static method references, generic instance refs, stream/map scenarios, and related inference behaviors.

@msridhar msridhar requested a review from lazaroclapp February 14, 2026 00:46
Copy link
Copy Markdown
Collaborator

@lazaroclapp lazaroclapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did another pass, minimal nits. I know I need to catch up to the changes that just came in, but this is starting to get to the point of complexity where I'd link issues for the remaining things and open separate PRs, personally 🙂

Edit: Never mind, I think the new changes were mostly the rebase, unless I am missing something.

Comment thread nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants