NullAway icon indicating copy to clipboard operation
NullAway copied to clipboard

Include method type parameters in astubx files.

Open haewiful opened this issue 1 month ago • 1 comments

This pull request adds method type parameter information to astubx files.

The unit tests are located in NullAway/jdk-annotations/jdk-integration-test/src/test/java/com/uber/nullaway/jdkannotations/JDKIntegrationTest.java and NullAway/jdk-annotations/astubx-generator/src/test/java/com/uber/nullaway/jdkannotations/AstubxTest.java.

Summary by CodeRabbit

  • New Features

    • Detect and record nullable upper bounds on generic type parameters to improve nullability inference.
  • Refactor

    • Expanded method annotation record to include type-parameter nullable-upper-bound info (public API updated).
  • Tests

    • Added and updated unit and integration tests to cover type-parameter nullability and the new record shape.

✏️ Tip: You can customize this high-level summary in your review settings.

haewiful avatar Dec 05 '25 20:12 haewiful

Walkthrough

Adds tracking and emission of per-method nullable upper bounds for type parameters and extends MethodAnnotationsRecord with a new ImmutableSet<Integer> typeParamNullableUpperbounds field and accessor. Updated usages to the new three-argument MethodAnnotationsRecord.create(...) everywhere (AstubxGenerator, LibraryModelGenerator, DefinitelyDerefedParamsDriver, tests). StubxWriter now emits an additional block of method-type-parameter nullable-upper-bound entries and StubxCacheUtil reads and caches that block. LibraryModelsHandler/ExternalStubxLibraryModels expose the cached mappings. New unit and integration tests cover nullable type-parameter upper-bound scenarios.

Possibly related PRs

  • uber/NullAway#1345: Implements propagation of per-method type-parameter nullable-upper-bound metadata and updates library-model generator and related wiring.
  • uber/NullAway#1243: Updates astubx generation and call sites of MethodAnnotationsRecord.create to accept the added nullable-type-parameter upper-bounds argument.

Suggested reviewers

  • yuxincs
  • lazaroclapp

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.16% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main objective of the pull request: adding method type parameter information to astubx files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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 and usage tips.

coderabbitai[bot] avatar Dec 06 '25 18:12 coderabbitai[bot]

Codecov Report

:x: Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 88.47%. Comparing base (03833a5) to head (a7b9c58). :warning: Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
.../uber/nullaway/jdkannotations/AstubxGenerator.java 90.90% 0 Missing and 1 partial :warning:
.../uber/nullaway/libmodel/LibraryModelGenerator.java 92.85% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1370   +/-   ##
=========================================
  Coverage     88.46%   88.47%           
- Complexity     2619     2626    +7     
=========================================
  Files            97       97           
  Lines          8774     8822   +48     
  Branches       1751     1762   +11     
=========================================
+ Hits           7762     7805   +43     
- Misses          504      509    +5     
  Partials        508      508           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Dec 18 '25 20:12 codecov[bot]