Skip to content

Handle unbound wildcards and interactions with captured types better - #1668

Open
msridhar wants to merge 1 commit into
type-substitution-copiesfrom
unbound-wildcard-annotations
Open

Handle unbound wildcards and interactions with captured types better#1668
msridhar wants to merge 1 commit into
type-substitution-copiesfrom
unbound-wildcard-annotations

Conversation

@msridhar

@msridhar msridhar commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

We correctly restore annotations from library models onto unbounded wildcard types, and the corresponding captured type variables. Add tests involving library models and also regular annotated source code, including a test with recursive bounds on the variables.

@msridhar

msridhar commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.75%. Comparing base (6dd76de) to head (659a6b2).

Files with missing lines Patch % Lines
...librarymodel/AddAnnotationToNestedTypeVisitor.java 52.63% 9 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##             type-substitution-copies    #1668      +/-   ##
==============================================================
+ Coverage                       87.72%   87.75%   +0.02%     
- Complexity                       3145     3148       +3     
==============================================================
  Files                             109      109              
  Lines                           10691    10716      +25     
  Branches                         2159     2161       +2     
==============================================================
+ Hits                             9379     9404      +25     
- Misses                            623      626       +3     
+ Partials                          689      686       -3     

☔ 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 changed the base branch from follow-up-on-wildcard-library-models to type-substitution-copies July 31, 2026 17:28
@msridhar
msridhar force-pushed the unbound-wildcard-annotations branch from c4b04e6 to ed438c9 Compare July 31, 2026 17:28
@msridhar
msridhar force-pushed the unbound-wildcard-annotations branch from ed438c9 to 659a6b2 Compare August 1, 2026 03:38
@msridhar
msridhar requested a review from lazaroclapp August 1, 2026 03:48
@msridhar
msridhar marked this pull request as ready for review August 1, 2026 03:48
@coderabbitai

coderabbitai Bot commented Aug 1, 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: 2ff8d099-111b-4dda-9db2-308bb0609182

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd76de and 659a6b2.

📒 Files selected for processing (5)
  • nullaway/src/main/java/com/uber/nullaway/librarymodel/AddAnnotationToNestedTypeVisitor.java
  • nullaway/src/test/java/com/uber/nullaway/jspecify/WildcardTests.java
  • test-java-lib/src/main/java/com/uber/lib/unannotated/UnboundWildcards.java
  • test-library-models/src/main/java/com/uber/nullaway/testlibrarymodels/TestLibraryModels.java
  • test-library-models/src/test/java/com/uber/nullaway/CustomLibraryModelsTests.java

Walkthrough

The change updates AddAnnotationToNestedTypeVisitor to annotate implicit upper bounds for unbounded and captured wildcards while preserving lower-bound rejection and bounded wildcard behavior. It adds an UnboundWildcards<T> test library class and corresponding nullable library models. New JSpecify tests cover captured wildcard assignments, modeled nullable bounds, and F-bounded generic cache lookups.

Possibly related issues

Possibly related PRs

  • uber/NullAway#1407 — Introduced the visitor and wildcard library-model tests extended by this change.
  • uber/NullAway#1615 — Modified wildcard-bound annotation handling in the same visitor.
  • uber/NullAway#1666 — Added related captured and unbounded wildcard handling.

Suggested reviewers: lazaroclapp, 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 summarizes the changes to unbound wildcards and captured type interactions.
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 unbound-wildcard-annotations

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.

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.

1 participant