Skip to content

Skip nested annotation restoration from raw source types - #1898

Merged
msridhar merged 1 commit into
uber:masterfrom
msridhar:issue-1897
Sep 29, 2026
Merged

msridhar merged 1 commit into
uber:masterfrom
msridhar:issue-1897

Conversation

@msridhar

@msridhar msridhar commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

When javac captures a wildcard, its computed upper bound can have type arguments even when the corresponding declaration bound is raw. Restore direct nullability annotations, but do not traverse type arguments of a raw source type.

Add a minimized regression test for #1897.

Fixes #1897

Assisted-by: Codex (gpt-6)

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a crash when processing wildcard types with raw generic bounds.

When javac captures a wildcard, its computed upper bound can have type arguments even when the corresponding declaration bound is raw. Restore direct nullability annotations, but do not traverse type arguments of a raw source type.

Add a minimized regression test for uber#1897.

Tests:
- ./gradlew :nullaway:test
- ./gradlew :nullaway:buildWithNullAway

Fixes uber#1897

Assisted-by: Codex (gpt-6)
@msridhar
msridhar requested a review from yuxincs September 29, 2026 19:47
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: uber/NullAway/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c7fe7b9e-6aa4-40d4-9131-616af1eed3d6

📥 Commits

Reviewing files that changed from the base of the PR and between f4a1e93 and 3439650.

📒 Files selected for processing (2)
  • nullaway/src/main/java/com/uber/nullaway/generics/TypeSubstitutionUtils.java
  • nullaway/src/test/java/com/uber/nullaway/jspecify/WildcardTests.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

visitClassType now stops recursive type restoration when the corresponding source type is raw or is not a class type. A regression test covers compiling a JSpecify wildcard example with a raw generic bound.

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 34396

The raw-bound wildcard case has regression coverage, and no material merge-blocking issue remains. Proceed with normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change for #1897 adds the raw-type guard in RestoreNullnessAnnotationsVisitor.visitClassType. The visitor now stops before it traverses raw type arguments and enclosing types. `issue1897Wildcard…
Out of Scope Changes check ✅ Passed The pull request changes only TypeSubstitutionUtils.java and the focused WildcardTests.java regression test. Both changes directly support #1897. No unrelated production behavior, public API, or u…
Title check ✅ Passed The title clearly and concisely describes the main change: preventing nested annotation restoration for raw source types.
Description check ✅ Passed The description directly explains the raw-type handling change, the regression test, and the linked issue.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.67%. Comparing base (f4a1e93) to head (3439650).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1898   +/-   ##
=========================================
  Coverage     87.67%   87.67%           
  Complexity     3499     3499           
=========================================
  Files           110      110           
  Lines         11641    11641           
  Branches       2403     2403           
=========================================
  Hits          10206    10206           
  Misses          657      657           
  Partials        778      778           

☔ 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 enabled auto-merge (squash) September 29, 2026 19:56
@msridhar
msridhar merged commit 7f92fef into uber:master Sep 29, 2026
19 checks passed
@msridhar
msridhar deleted the issue-1897 branch September 29, 2026 19:56
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.

NPE when processing <?> (v0.14.2)

2 participants