Skip to content

Remove duplicate NestedAnnotationInfo source from NullAway module - #1659

Merged
msridhar merged 1 commit into
masterfrom
deduplicate-source
Jul 26, 2026
Merged

Remove duplicate NestedAnnotationInfo source from NullAway module#1659
msridhar merged 1 commit into
masterfrom
deduplicate-source

Conversation

@msridhar

@msridhar msridhar commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1657

NestedAnnotationInfo was duplicated between the nullaway and library-model-generator modules. This PR replaces the two copies with one shared source file owned by library-model-generator and compiled into both modules.

Specifically, it:

  • Moves the canonical class into a shared source directory under library-model-generator.
  • Includes that shared directory in both modules’ main source sets.
  • Updates NullAway and test library models to use com.uber.nullaway.libmodel.NestedAnnotationInfo.
  • Moves NestedAnnotationInfoTest to library-model-generator.
  • Avoids publishing a separate generator artifact or adding Shadow/fat-JAR configuration.
  • Ensures only NestedAnnotationInfo, rather than unrelated generator implementation classes, is included in the NullAway JAR.

This changes the type exposed by LibraryModels.nestedAnnotationsForMethods() from com.uber.nullaway.librarymodel.NestedAnnotationInfo to com.uber.nullaway.libmodel.NestedAnnotationInfo.

Summary by CodeRabbit

  • New Features
    • Added shared nested nullability modeling metadata for annotations reached via type paths (arrays, type arguments, wildcard bounds).
    • Added validation to reject empty type paths for nested annotations.
  • Refactor
    • Moved the nested annotation model into the shared library-model sources and updated library model processing to use it.
    • Updated build setup to compile the shared sources with the main code.
  • Tests
    • Updated nested annotation tests and imports to reflect the shared model location.
  • Chores
    • Adjusted formatting configuration to exclude generated/shared sources from the main formatter.

@msridhar

msridhar commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

This change is part of the following stack:

Change managed by git-spice.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 48edefd3-8c4f-4d32-91c6-e85e5d0801b8

📥 Commits

Reviewing files that changed from the base of the PR and between acab92d and 7c3c333.

📒 Files selected for processing (10)
  • library-model/library-model-generator/build.gradle
  • library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java
  • library-model/library-model-generator/src/test/java/com/uber/nullaway/libmodel/NestedAnnotationInfoTest.java
  • nullaway/build.gradle
  • nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/AddAnnotationToNestedTypeVisitor.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java
  • test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java
💤 Files with no reviewable changes (1)
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java

Walkthrough

Moves NestedAnnotationInfo and its nested types into com.uber.nullaway.libmodel under shared library-model sources. Adds nonempty type-path validation, configures both Gradle projects to compile the shared source tree, and excludes it from root formatting. Updates production and test imports to reference the relocated model.

Possibly related PRs

  • uber/NullAway#1407 — Introduces related nested-nullability model APIs and updates core consumers.
  • uber/NullAway#1456 — Overlaps with nested-annotation model wiring in library-model loading.
  • uber/NullAway#1649 — Adjusts the same model’s nonempty typePath validation.

Suggested reviewers: 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 accurately states the main change: removing the duplicated NestedAnnotationInfo from the NullAway module.
Linked Issues check ✅ Passed The PR matches #1657 by moving NestedAnnotationInfo to shared source, wiring NullAway/library-model to it, and removing the duplicate NullAway copy.
Out of Scope Changes check ✅ Passed The changes stay focused on the shared NestedAnnotationInfo move and related import/build updates, with no obvious unrelated code additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 deduplicate-source

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 Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.07%. Comparing base (53f5dc0) to head (7c3c333).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1659   +/-   ##
=========================================
  Coverage     88.06%   88.07%           
+ Complexity     3076     3075    -1     
=========================================
  Files           105      104    -1     
  Lines         10356    10344   -12     
  Branches       2095     2094    -1     
=========================================
- Hits           9120     9110   -10     
+ Misses          581      580    -1     
+ Partials        655      654    -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 force-pushed the update-shadow-plugin branch from 35d901e to eb38b11 Compare July 26, 2026 01:25
@msridhar
msridhar changed the base branch from update-shadow-plugin to var-generic-method-inference-bug July 26, 2026 01:25
@msridhar
msridhar force-pushed the deduplicate-source branch from a202275 to acab92d Compare July 26, 2026 01:25

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java`:
- Around line 17-22: Update StubxCacheUtil.parseStubStream() to validate
typePathLength before constructing NestedAnnotationInfo, treating zero or
negative lengths as malformed stubx input and reporting them through the
parser’s established format/error handling rather than allowing
IllegalArgumentException to escape. Keep NestedAnnotationInfo’s nonempty-path
invariant intact and preserve normal parsing for positive lengths.
🪄 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 Plus

Run ID: f812a512-03ea-4654-a2a2-6747a732f1f8

📥 Commits

Reviewing files that changed from the base of the PR and between a202275 and acab92d.

📒 Files selected for processing (10)
  • library-model/library-model-generator/build.gradle
  • library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java
  • library-model/library-model-generator/src/test/java/com/uber/nullaway/libmodel/NestedAnnotationInfoTest.java
  • nullaway/build.gradle
  • nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/AddAnnotationToNestedTypeVisitor.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java
  • test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java
💤 Files with no reviewable changes (1)
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java

@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

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

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

Inline comments:
In
`@library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java`:
- Around line 17-22: Update StubxCacheUtil.parseStubStream() to validate
typePathLength before constructing NestedAnnotationInfo, treating zero or
negative lengths as malformed stubx input and reporting them through the
parser’s established format/error handling rather than allowing
IllegalArgumentException to escape. Keep NestedAnnotationInfo’s nonempty-path
invariant intact and preserve normal parsing for positive lengths.
🪄 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 Plus

Run ID: f812a512-03ea-4654-a2a2-6747a732f1f8

📥 Commits

Reviewing files that changed from the base of the PR and between a202275 and acab92d.

📒 Files selected for processing (10)
  • library-model/library-model-generator/build.gradle
  • library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java
  • library-model/library-model-generator/src/test/java/com/uber/nullaway/libmodel/NestedAnnotationInfoTest.java
  • nullaway/build.gradle
  • nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/AddAnnotationToNestedTypeVisitor.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java
  • test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java
💤 Files with no reviewable changes (1)
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java
🛑 Comments failed to post (1)
library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java (1)

17-22: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
rg -n -C 4 'typePathLength|methodNestedAnnotSize|NestedAnnotationInfo' --glob '*.java' .

Repository: uber/NullAway

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -eu

echo "== candidate files =="
fd -a 'StubxCacheUtil|NestedAnnotationInfo|Stubx' library-model . | sed 's#^\./##'

echo
echo "== NestedAnnotationInfo.java =="
cat -n library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java

echo
echo "== nested model tests =="
cat -n library-model/library-model-generator/src/test/java/com/uber/nullaway/libmodel/NestedAnnotationInfoTest.java

echo
echo "== targeted stubx references =="
rg -n -C 3 'typePathLength|typePath|nestedAnnot|NestedAnnotation|IllegalArgumentException|IOException' library-model/library-model-generator src --glob '*.java'

Repository: uber/NullAway

Length of output: 21228


🏁 Script executed:

#!/bin/bash
set -eu

echo "== StubxCacheUtil outline and relevant lines =="
rg -n -C 5 'tryRead|methodNestedAnnotSize| NestedAnnotationInfo|typePath|IOException|parse|read' nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java
sed -n '1,260p' nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java

echo
echo "== CreateNestedAnnotationInfoVisitor relevant lines =="
sed -n '1,260p' jdk-javac-plugin/src/main/java/com/uber/nullaway/javacplugin/CreateNestedAnnotationInfoVisitor.java

echo
echo "== other NestedAnnotationInfo construction sites =="
rg -n 'new NestedAnnotationInfo|NestedAnnotationInfo\(' --glob '*.java' .

Repository: uber/NullAway

Length of output: 31711


Handle malformed nested stubx paths during parsing.

StubxCacheUtil.parseStubStream() reads typePathLength and then constructs NestedAnnotationInfo; a zero or negative length makes parseStubStream() throw IllegalArgumentException from a throws IOException method and can turn an invalid .astubx into an unexpected runtime error. Translate invalid lengths into the parser’s normal format/Error behavior instead of keeping the invariant only in the model record.

🤖 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
`@library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java`
around lines 17 - 22, Update StubxCacheUtil.parseStubStream() to validate
typePathLength before constructing NestedAnnotationInfo, treating zero or
negative lengths as malformed stubx input and reporting them through the
parser’s established format/error handling rather than allowing
IllegalArgumentException to escape. Keep NestedAnnotationInfo’s nonempty-path
invariant intact and preserve normal parsing for positive lengths.

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

Fair enough, LGTM!

@msridhar
msridhar force-pushed the var-generic-method-inference-bug branch from fe86b32 to b01c318 Compare July 26, 2026 21:40
Base automatically changed from var-generic-method-inference-bug to master July 26, 2026 21:56
@msridhar
msridhar force-pushed the deduplicate-source branch from acab92d to 7c3c333 Compare July 26, 2026 22:32
@msridhar
msridhar enabled auto-merge (squash) July 26, 2026 22:33

@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: 2

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

Inline comments:
In
`@library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java`:
- Around line 17-22: Add Javadoc to the compact constructor of
NestedAnnotationInfo documenting that typePath must be non-empty and that an
IllegalArgumentException is thrown when it is empty. Keep the existing
validation behavior unchanged.

In `@nullaway/src/main/java/com/uber/nullaway/LibraryModels.java`:
- Line 33: Document the package relocation of NestedAnnotationInfo as an
intentional breaking API change, noting that
LibraryModels.nestedAnnotationsForMethods() and ServiceLoader-based external
model providers must be rebuilt, including sample-library-model consumers.
🪄 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 Plus

Run ID: 48edefd3-8c4f-4d32-91c6-e85e5d0801b8

📥 Commits

Reviewing files that changed from the base of the PR and between acab92d and 7c3c333.

📒 Files selected for processing (10)
  • library-model/library-model-generator/build.gradle
  • library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java
  • library-model/library-model-generator/src/test/java/com/uber/nullaway/libmodel/NestedAnnotationInfoTest.java
  • nullaway/build.gradle
  • nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/AddAnnotationToNestedTypeVisitor.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java
  • test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java
💤 Files with no reviewable changes (1)
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java

@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

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

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

Inline comments:
In
`@library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java`:
- Around line 17-22: Add Javadoc to the compact constructor of
NestedAnnotationInfo documenting that typePath must be non-empty and that an
IllegalArgumentException is thrown when it is empty. Keep the existing
validation behavior unchanged.

In `@nullaway/src/main/java/com/uber/nullaway/LibraryModels.java`:
- Line 33: Document the package relocation of NestedAnnotationInfo as an
intentional breaking API change, noting that
LibraryModels.nestedAnnotationsForMethods() and ServiceLoader-based external
model providers must be rebuilt, including sample-library-model consumers.
🪄 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 Plus

Run ID: 48edefd3-8c4f-4d32-91c6-e85e5d0801b8

📥 Commits

Reviewing files that changed from the base of the PR and between acab92d and 7c3c333.

📒 Files selected for processing (10)
  • library-model/library-model-generator/build.gradle
  • library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java
  • library-model/library-model-generator/src/test/java/com/uber/nullaway/libmodel/NestedAnnotationInfoTest.java
  • nullaway/build.gradle
  • nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/AddAnnotationToNestedTypeVisitor.java
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java
  • test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java
💤 Files with no reviewable changes (1)
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/NestedAnnotationInfo.java
🛑 Comments failed to post (2)
library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java (1)

17-22: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Document the compact constructor.

This constructor enforces a public invariant and is non-trivial, but it has no Javadoc. Document the non-empty requirement and IllegalArgumentException.

As per coding guidelines, every non-trivial method, including private methods, must have Javadoc.

Proposed documentation
+  /**
+   * Validates that the nested annotation has a non-empty type path.
+   *
+   * `@throws` IllegalArgumentException if {`@code` typePath} is empty
+   */
   public NestedAnnotationInfo {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  /**
   * Validates that the nested annotation has a non-empty type path.
   *
   * `@throws` IllegalArgumentException if {`@code` typePath} is empty
   */
  public NestedAnnotationInfo {
    if (typePath.isEmpty()) {
      throw new IllegalArgumentException(
          "Nested annotation type paths must be nonempty; use a top-level parameter or return model");
    }
  }
🤖 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
`@library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java`
around lines 17 - 22, Add Javadoc to the compact constructor of
NestedAnnotationInfo documenting that typePath must be non-empty and that an
IllegalArgumentException is thrown when it is empty. Keep the existing
validation behavior unchanged.

Source: Coding guidelines

nullaway/src/main/java/com/uber/nullaway/LibraryModels.java (1)

33-33: 🗄️ Data Integrity & Integration | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

rg -n --glob '*.java' \
  -e 'implements[[:space:]]+LibraryModels' \
  -e 'nestedAnnotationsForMethods[[:space:]]*\(' .

rg -n --glob '*.java' \
  'com\.uber\.nullaway\.librarymodel\.NestedAnnotationInfo' .

Repository: uber/NullAway

Length of output: 2495


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- files ---\n'
git ls-files | rg '(^nullaway/src/main/java/com/uber/nullaway/LibraryModels.java$|nestedAnnotation|NestedAnnotationInfo|LibraryModelsHandler|TestLibraryModels|ExampleLibraryModels|gradle.build|pom.xml|build.gradle|settings.gradle)'

printf '\n--- LibraryModels outline around nestedAnnotationsForMethods ---\n'
ast-grep outline nullaway/src/main/java/com/uber/nullaway/LibraryModels.java --view expanded | sed -n '1,220p' || true
printf '\n--- LibraryModels.java relevant lines ---\n'
sed -n '1,80p;110,135p' nullaway/src/main/java/com/uber/nullaway/LibraryModels.java | cat -n

printf '\n--- NestedAnnotationInfo definitions/imports/usages ---\n'
rg -n --glob '*.java' 'class NestedAnnotationInfo|enum NestedAnnotationInfo|import .*NestedAnnotationInfo|NestedAnnotationInfo' nullaway test-library-models sample-library-model jdk-javac-plugin || true

printf '\n--- ServiceLoader/LibraryModelsHandler integration ---\n'
sed -n '1,70p;160,185p;440,470p;550,575p' nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java | cat -n

Repository: uber/NullAway

Length of output: 242


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- files ---'
git ls-files | rg '(^nullaway/src/main/java/com/uber/nullaway/LibraryModels.java$|nestedAnnotation|NestedAnnotationInfo|LibraryModelsHandler|TestLibraryModels|ExampleLibraryModels|gradle.build|pom.xml|build.gradle|settings.gradle)'

echo
echo '--- LibraryModels.java relevant lines ---'
sed -n '1,80p;110,135p' nullaway/src/main/java/com/uber/nullaway/LibraryModels.java | cat -n

echo
echo '--- NestedAnnotationInfo definitions/imports/usages ---'
rg -n --glob '*.java' 'class NestedAnnotationInfo|enum NestedAnnotationInfo|import .*NestedAnnotationInfo|NestedAnnotationInfo' nullaway test-library-models sample-library-model jdk-javac-plugin || true

echo
echo '--- LibraryModelsHandler integration ---'
sed -n '1,70p;160,185p;440,470p;550,575p' nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java | cat -n

echo
echo '--- LibraryModels implementations ---'
sed -n '20,35p;90,115p' test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java | cat -n || true
sed -n '185,205p' test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java | cat -n || true
sed -n '20,35p;90,115p' sample-library-model/src/main/java/com/uber/modelexample/ExampleLibraryModels.java | cat -n || true
sed -n '120,140p' nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java | cat -n || true
sed -n '1220,1255p' nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java | cat -n || true
sed -n '1355,1380p' nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java | cat -n || true
sed -n '1468,1490p' nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java | cat -n || true
sed -n '1648,1675p;1730,1760p' nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java | cat -n || true

Repository: uber/NullAway

Length of output: 47827


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- NestedAnnotationInfo definition ---'
sed -n '1,220p' library-model/library-model-generator/src/shared/java/com/uber/nullaway/libmodel/NestedAnnotationInfo.java | cat -n

echo
echo '--- LibraryModels method reference ---'
sed -n '90,105p' nullaway/src/main/java/com/uber/nullaway/LibraryModels.java | cat -n

echo
echo '--- sample-library-model build metadata ---'
cat sample-library-model/build.gradle | cat -n || true
cat test-library-models/build.gradle | cat -n || true

Repository: uber/NullAway

Length of output: 6222


Document the NestedAnnotationInfo package relocation as an API breakage.

LibraryModels.nestedAnnotationsForMethods() returns NestedAnnotationInfo through ServiceLoader, and sample-library-model imports it directly. Moving com.uber.nullaway.librarymodel.NestedAnnotationInfo changes the return-type contract for external model providers, so providers should be rebuilt; if this is intentional, document the breaking change for downstream users.

🤖 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/LibraryModels.java` at line 33,
Document the package relocation of NestedAnnotationInfo as an intentional
breaking API change, noting that LibraryModels.nestedAnnotationsForMethods() and
ServiceLoader-based external model providers must be rebuilt, including
sample-library-model consumers.

@msridhar
msridhar merged commit 1ab0adb into master Jul 26, 2026
14 checks passed
@msridhar
msridhar deleted the deduplicate-source branch July 26, 2026 22:49
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.

Fix duplicated NestedAnnotationInfo class

2 participants