Skip to content

Remove LegacyAnnotationLocations flag - #1640

Merged
msridhar merged 1 commit into
masterfrom
remove-legacyannotations-flag
Jul 19, 2026
Merged

msridhar merged 1 commit into
masterfrom
remove-legacyannotations-flag

Conversation

@msridhar

@msridhar msridhar commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Remove support for legacy annotation locations (see current docs). This lets us delete a bunch of support and test code.

Fixes #1637

Summary by CodeRabbit

  • Breaking Changes

    • Removed support for the legacy annotation-location configuration and its associated command-line option.
    • Annotation handling now consistently uses type-use locations, including nested types and varargs.
    • Removed legacy-mode compatibility checks and related configuration APIs.
  • Bug Fixes

    • Improved consistency when detecting nullable and non-null annotations on generic, array, nested, and varargs types.
    • Updated initialization checks to use the complete set of applicable annotations.

@msridhar

Copy link
Copy Markdown
Contributor Author

This change is part of the following stack:

Change managed by git-spice.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The pull request removes the legacy annotation-location configuration and its CLI flag, replaces the Config accessor, and simplifies annotation collection and nullness handling to use configuration-independent type-use processing. Nullable annotation position checks now run unconditionally, and varargs handling no longer uses legacy-mode branches. Legacy-mode array, type-use, varargs, and flag-conflict tests are deleted.

Possibly related issues

Possibly related PRs

Suggested reviewers: yuxincs, lazaroclapp

🚥 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 matches the main change: removing the LegacyAnnotationLocations flag and related support.
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 remove-legacyannotations-flag

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.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java (1)

454-494: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Pass the annotated Type here instead of symbol
On the method-return and parameter fallback paths, symbol is the enclosing MethodSymbol, so isDirectTypeUseAnnotation runs against MethodType and skips the nested-class innermost-type check. Thread methodSymbol.getReturnType() / varSymbol.type into the helper instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java` around lines
454 - 494, Update isDirectTypeUseAnnotation to accept the annotated Type rather
than a Symbol, and use that Type for nested-class detection and nesting-depth
checks. Change its method-return fallback caller to pass
methodSymbol.getReturnType() and its parameter fallback caller to pass
varSymbol.type, ensuring the helper never evaluates the enclosing MethodSymbol’s
MethodType.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java`:
- Around line 454-494: Update isDirectTypeUseAnnotation to accept the annotated
Type rather than a Symbol, and use that Type for nested-class detection and
nesting-depth checks. Change its method-return fallback caller to pass
methodSymbol.getReturnType() and its parameter fallback caller to pass
varSymbol.type, ensuring the helper never evaluates the enclosing MethodSymbol’s
MethodType.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2b256290-fa75-4ac0-a955-433e2ceba062

📥 Commits

Reviewing files that changed from the base of the PR and between 043f276 and 390134c.

📒 Files selected for processing (10)
  • nullaway/src/main/java/com/uber/nullaway/Config.java
  • nullaway/src/main/java/com/uber/nullaway/DummyOptionsConfig.java
  • nullaway/src/main/java/com/uber/nullaway/ErrorProneCLIFlagsConfig.java
  • nullaway/src/main/java/com/uber/nullaway/NullAway.java
  • nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java
  • nullaway/src/main/java/com/uber/nullaway/Nullness.java
  • nullaway/src/test/java/com/uber/nullaway/ArrayTests.java
  • nullaway/src/test/java/com/uber/nullaway/LegacyAndJspecifyModeTest.java
  • nullaway/src/test/java/com/uber/nullaway/LegacyVarargsTests.java
  • nullaway/src/test/java/com/uber/nullaway/TypeUseAnnotationsTests.java
💤 Files with no reviewable changes (7)
  • nullaway/src/test/java/com/uber/nullaway/LegacyAndJspecifyModeTest.java
  • nullaway/src/main/java/com/uber/nullaway/Config.java
  • nullaway/src/test/java/com/uber/nullaway/LegacyVarargsTests.java
  • nullaway/src/main/java/com/uber/nullaway/DummyOptionsConfig.java
  • nullaway/src/main/java/com/uber/nullaway/ErrorProneCLIFlagsConfig.java
  • nullaway/src/test/java/com/uber/nullaway/TypeUseAnnotationsTests.java
  • nullaway/src/test/java/com/uber/nullaway/ArrayTests.java

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.17%. Comparing base (043f276) to head (390134c).

Files with missing lines Patch % Lines
...c/main/java/com/uber/nullaway/NullabilityUtil.java 88.88% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1640      +/-   ##
============================================
- Coverage     88.21%   88.17%   -0.04%     
+ Complexity     3076     3056      -20     
============================================
  Files           105      105              
  Lines         10296    10270      -26     
  Branches       2087     2072      -15     
============================================
- Hits           9083     9056      -27     
  Misses          573      573              
- Partials        640      641       +1     

☔ 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 requested review from seemantasaha and yuxincs July 19, 2026 21:21
@msridhar
msridhar merged commit 472f948 into master Jul 19, 2026
8 of 10 checks passed
@msridhar
msridhar deleted the remove-legacyannotations-flag branch July 19, 2026 22:04
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.

Remove LegacyAnnotationLocations flag

2 participants