Skip to content

Fix bug with storing library model type variable upper bounds - #1687

Merged
msridhar merged 3 commits into
masterfrom
biconsumer-model
Aug 9, 2026
Merged

Fix bug with storing library model type variable upper bounds#1687
msridhar merged 3 commits into
masterfrom
biconsumer-model

Conversation

@msridhar

@msridhar msridhar commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

We can have multiple type variables with modeled upper bounds. Before we used a Map incorrectly, causing issues for types like BiConsumer. Now use a MultiMap.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of multiple nullable upper bounds in external library models.
    • Fixed nullable upper-bound processing for JSpecify-mode analysis, including BiConsumer declarations.
    • Improved analysis accuracy for code using generic type parameters with multiple nullable constraints.
  • Tests

    • Added regression coverage for nullable upper bounds under JSpecify nullness checking.
    • Added validation for JSpecify library models configured with strict null-marked analysis.

@msridhar

msridhar commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

This change is part of the following stack:

Change managed by git-spice.

@msridhar
msridhar requested a review from yuxincs August 8, 2026 22:00
@coderabbitai

coderabbitai Bot commented Aug 8, 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: 3f7c1a44-8d46-433f-92b8-35cb1da28ab3

📥 Commits

Reviewing files that changed from the base of the PR and between 1eb615d and d1d713a.

📒 Files selected for processing (1)
  • nullaway/src/test/java/com/uber/nullaway/JSpecifyJDKModelsTest.java

Walkthrough

Updated upper-bound caches to use SetMultimap<String, Integer>, allowing multiple nullable upper-bound indices per class. Updated cache initialization, accessors, and traversal. Added a JSpecify regression test for a nullable BiConsumer upper bound with OnlyNullMarked=true.

Possibly related PRs

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 clearly and concisely describes the main change: correcting storage of library model type-variable upper bounds.
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 biconsumer-model

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.

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 `@nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java`:
- Line 1748: Add Javadoc to
ExternalStubxLibraryModels.typeVariablesWithNullableUpperBounds(), documenting
that the cache maps class-name keys to indexes of type variables with nullable
upper bounds. Keep the documentation focused on the method’s conversion behavior
and its key/value meanings.
🪄 Autofix

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: 7d66f625-c7a7-4c8c-b8b9-d35898940bdd

📥 Commits

Reviewing files that changed from the base of the PR and between 14ac5c1 and 1eb615d.

📒 Files selected for processing (3)
  • nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/StubxCacheUtil.java
  • nullaway/src/test/java/com/uber/nullaway/JSpecifyJDKModelsTest.java

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.87%. Comparing base (b61752e) to head (c338eba).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1687   +/-   ##
=========================================
  Coverage     87.87%   87.87%           
  Complexity     3167     3167           
=========================================
  Files           109      109           
  Lines         10742    10742           
  Branches       2172     2172           
=========================================
  Hits           9440     9440           
  Misses          617      617           
  Partials        685      685           

☔ 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) August 8, 2026 23:17
@msridhar
msridhar merged commit a5903b1 into master Aug 9, 2026
14 checks passed
@msridhar
msridhar deleted the biconsumer-model branch August 9, 2026 00:15
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.

2 participants