Skip to content

Fix subtle issue with invalid TreePaths - #1681

Merged
msridhar merged 2 commits into
masterfrom
issue-1680
Aug 7, 2026
Merged

msridhar merged 2 commits into
masterfrom
issue-1680

Conversation

@msridhar

@msridhar msridhar commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1680

See full diagnosis in #1680 (comment). This is a fix for the crash only; we will do follow-on fixes / cleanups in separate PRs.

@msridhar

msridhar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

This change is part of the following stack:

Change managed by git-spice.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 56ee55c1-afec-40c3-a9c0-5ed6603fa0ad

📥 Commits

Reviewing files that changed from the base of the PR and between d52c586 and 159d910.

📒 Files selected for processing (2)
  • nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathNullnessPropagation.java
  • nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodLambdaOrMethodRefArgTests.java

Walkthrough

genericReturnIsNullable now derives the invocation TreePath and creates a path-specific VisitorState for generic return nullness analysis. A regression test adds a multi-file generic nested-lambda scenario and verifies that compilation completes with the expected nullable exception.getCause() diagnostic.

Possibly related PRs

  • uber/NullAway#1309: Adds related path-aware generic return nullness inference for nested-lambda analysis.
  • uber/NullAway#1438: Covers related generic method-reference inference and TreePath context handling.
  • uber/NullAway#1570: Applies related TreePath propagation fixes to generic nullness analysis.

Suggested reviewers: lazaroclapp, yuxincs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the fix for invalid TreePaths, which is the primary change in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-1680

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 (squash) August 7, 2026 16:06
@msridhar
msridhar requested a review from yuxincs August 7, 2026 16:06
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.71%. Comparing base (d52c586) to head (159d910).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1681   +/-   ##
=========================================
  Coverage     87.71%   87.71%           
  Complexity     3136     3136           
=========================================
  Files           109      109           
  Lines         10612    10614    +2     
  Branches       2144     2144           
=========================================
+ Hits           9308     9310    +2     
  Misses          626      626           
  Partials        678      678           

☔ 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 merged commit b7342a6 into master Aug 7, 2026
10 checks passed
@msridhar
msridhar deleted the issue-1680 branch August 7, 2026 16:10
@coderabbitai coderabbitai Bot mentioned this pull request Aug 7, 2026
vlsi added a commit to vlsi/NullAway that referenced this pull request Aug 24, 2026
An AccessPathNullnessAnalysis instance is cached in the javac Context and shared by every compilation unit of the task, so the VisitorState its transfer functions hold belongs to whichever file created the instance. VisitorState.reportMatch() routes a diagnostic through the DescriptionListener in that state, and the listener decides which file the diagnostic is attributed to. An error raised while dataflow was running therefore landed in an unrelated file, at a position past its end, and for a failure that only dataflow raises it was the sole diagnostic of the build. Threading the TreePath through (apache#1680, apache#1681) did not help, since the path was already correct.

Refresh the state of both transfer functions whenever AccessPathNullnessAnalysis.instance() hands out the cached instance for a different compilation unit.

Fixes apache#1733

This is also what puts the extra report of apache#1725 in an unrelated file. The second half of that issue, the same warning reported twice at the same position, is a separate defect: it reproduces on master within a single compilation unit and is untouched here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

JSpecify mode: NPE in CFGTranslationPhaseOne.getReceiver for a lambda nested inside a lambda passed to a generic method

2 participants