Skip to content

Test case for #1528#1556

Merged
msridhar merged 2 commits into
masterfrom
issue-1528
Apr 29, 2026
Merged

Test case for #1528#1556
msridhar merged 2 commits into
masterfrom
issue-1528

Conversation

@msridhar

@msridhar msridhar commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1528

Add a test case to ensure we handle this case correctly.

Summary by CodeRabbit

  • Tests
    • Added regression test to enhance validation of nullability inference with generic method type parameters and method references. The test specifically covers stream operations combined with wildcard type parameters, strengthening test coverage for complex type inference scenarios and improving overall quality assurance.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

A regression test is added to GenericMethodLambdaOrMethodRefArgTests to exercise nullability inference with generic method type parameters and method references. The test case defines a generic and method accepting a Stream<T> and a Function<T, @nullable Pair>, then tests two scenarios involving method references over Map.entrySet().stream(). One method reference variant is expected to produce a nullability-related diagnostic, while another using wildcard type parameters is expected to compile without diagnostics.

Possibly related PRs

  • PR #1428: Exercises lambda target-type and type-variable annotation propagation in similar generic method and method reference contexts
  • PR #1471: Alters generic-method type-variable inference behavior in GenericsChecks.java, directly affecting how unconstrained type variables are treated in the same inference codepath
  • PR #1473: Fixes nullability-inference for generic method types by restoring nullability annotations that javac elides at call sites

Suggested reviewers

  • yuxincs
  • lazaroclapp
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Test case for #1528' is directly related to the pull request objective of adding a regression test for issue #1528.
Linked Issues check ✅ Passed The pull request adds a regression test for issue #1528 covering the generic method type parameter nullability matching scenario described in the linked issue.
Out of Scope Changes check ✅ Passed All changes are within scope: a single new test method (issue1528) in the appropriate test class addressing the exact scenario from the linked issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-1528

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 6/8 reviews remaining, refill in 14 minutes and 26 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@msridhar msridhar requested a review from yuxincs April 29, 2026 17:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodLambdaOrMethodRefArgTests.java`:
- Around line 996-999: The test currently asserts a diagnostic for
Pair::fromMapEntry inside the method Test and(Map<String, String> map), which
encodes the regression instead of the intended fix; remove the BUG comment on
the return line (the "// BUG: Diagnostic contains: parameter type of referenced
method is Entry<String, `@Nullable` String>") so that the call return
and(map.entrySet().stream(), Pair::fromMapEntry) is allowed/compiles again per
issue `#1528` and no diagnostic is expected for Pair::fromMapEntry.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8bf36a28-0afe-4bf9-a082-0459286fc333

📥 Commits

Reviewing files that changed from the base of the PR and between da3cc0d and a492536.

📒 Files selected for processing (1)
  • nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodLambdaOrMethodRefArgTests.java

@msridhar msridhar enabled auto-merge (squash) April 29, 2026 17:46
@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (da3cc0d) to head (a492536).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1556   +/-   ##
=========================================
  Coverage     88.52%   88.52%           
  Complexity     2862     2862           
=========================================
  Files           103      103           
  Lines          9522     9522           
  Branches       1911     1911           
=========================================
  Hits           8429     8429           
  Misses          528      528           
  Partials        565      565           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@msridhar msridhar requested a review from seemantasaha April 29, 2026 18:14
@msridhar msridhar merged commit dc60573 into master Apr 29, 2026
13 checks passed
@msridhar msridhar deleted the issue-1528 branch April 29, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible regression in type parameter nullability matching in 0.13.2

2 participants