Skip to content

Cleanup: centralize lambda and method-reference type lookup - #2070

Merged
msridhar merged 1 commit into
masterfrom
cleanup-repeated-type-lookup
Oct 25, 2026
Merged

msridhar merged 1 commit into
masterfrom
cleanup-repeated-type-lookup

Conversation

@msridhar

@msridhar msridhar commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Add GenericsChecks.getPolyExpressionType to prefer NullAway's inferred type and fall back to javac's attributed type, capturing a repeated pattern in the code. Use the shared lookup in override checking, lambda dataflow initialization, contract handling, and explicit lambda parameter checks, preserving raw-target filtering in the latter. No logic changes.

Validation: ./gradlew :nullaway:test :nullaway:buildWithNullAway passes;
all changed executable lines and branches are covered.

Assisted-by: Codex (gpt-6)

Summary by CodeRabbit

  • Bug Fixes
    • Improved nullness analysis for lambdas and method references when their types are inferred or explicitly declared.
    • Updated checks involving lambda parameters, return values, and method overrides to use consistent type information, reducing incorrect or missing diagnostics.

Add GenericsChecks.getPolyExpressionType to prefer NullAway's inferred
type and fall back to javac's attributed type. Use the shared lookup in
override checking, lambda dataflow initialization, contract handling, and
explicit lambda parameter checks, preserving raw-target filtering in the
latter.

Validation: ./gradlew :nullaway:test :nullaway:buildWithNullAway passes;
all changed executable lines and branches are covered.

Assisted-by: Codex (gpt-6)
@msridhar
msridhar requested review from vlsi and yuxincs October 24, 2026 23:53

@yuxincs yuxincs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice!

@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 824e5d1 and f215328.

Files selected for processing: 4
  • nullaway/src/main/java/com/uber/nullaway/NullAway.java
  • nullaway/src/main/java/com/uber/nullaway/dataflow/CoreNullnessStoreInitializer.java
  • nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/contract/ContractHandler.java

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

GenericsChecks now provides getPolyExpressionType, which returns a stored inferred type or falls back to the attributed type. Lambda and method-reference checks in NullAway, CoreNullnessStoreInitializer, and ContractHandler use this lookup. Explicit lambda parameter checking also uses it while retaining raw-type filtering.

Suggested reviewers: vlsi, dbwiddis

Priority: Low

Change: Refactor

Merge Risk: Minimal · up to f2153

No actionable risk remains from the type-lookup cleanup after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the centralization of lambda and method-reference type lookup, which is the main change.
Description check Passed The description accurately summarizes the new shared lookup, its usage across affected components, preserved behavior, and validation results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

@msridhar
msridhar enabled auto-merge October 24, 2026 23:58
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.19%. Comparing base (824e5d1) to head (f215328).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2070      +/-   ##
============================================
- Coverage     89.20%   89.19%   -0.02%     
  Complexity       38       38              
============================================
  Files           119      119              
  Lines         12776    12758      -18     
  Branches       2592     2586       -6     
============================================
- Hits          11397    11379      -18     
  Misses          623      623              
  Partials        756      756              

☔ View full report in Codecov by Harness.
📢 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 added this pull request to the merge queue Oct 25, 2026
Merged via the queue into master with commit 047de64 Oct 25, 2026
22 checks passed
@msridhar
msridhar deleted the cleanup-repeated-type-lookup branch October 25, 2026 00:23
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.

2 participants