Fix subtype checking for nested captured types - #1663
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1663 +/- ##
============================================
+ Coverage 87.75% 87.78% +0.02%
- Complexity 3132 3136 +4
============================================
Files 109 109
Lines 10580 10586 +6
Branches 2136 2140 +4
============================================
+ Hits 9285 9293 +8
+ Misses 615 613 -2
Partials 680 680 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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/generics/CheckIdenticalNullabilityVisitor.java`:
- Around line 41-60: Add Javadoc to the non-trivial `visitClassType` method in
`CheckIdenticalNullabilityVisitor`, documenting its purpose and the relevant
wildcard/captured-type handling, including the behavior controlled by
`handleWildcardGenerics()`. Keep the implementation unchanged.
🪄 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: b24f7c50-1799-4ca5-a9f0-5d04538ce4c2
📒 Files selected for processing (2)
nullaway/src/main/java/com/uber/nullaway/generics/CheckIdenticalNullabilityVisitor.javanullaway/src/test/java/com/uber/nullaway/jspecify/WildcardTests.java
There was a problem hiding this comment.
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/generics/CheckIdenticalNullabilityVisitor.java`:
- Line 124: Add Javadoc to the non-trivial visitArrayType method, documenting
its purpose, parameters, and return value while accurately describing how it
compares array component nullability. Do not alter the existing
haveIdenticalNullability behavior.
🪄 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: aec8c925-8f44-48a2-b812-37d0eb7717c6
📒 Files selected for processing (2)
nullaway/src/main/java/com/uber/nullaway/generics/CheckIdenticalNullabilityVisitor.javanullaway/src/test/java/com/uber/nullaway/jspecify/WildcardTests.java
872b67b to
9583b50
Compare
9583b50 to
f54e916
Compare
The new test
wildcardCaptureReturnPreservesNestedNullabilityis the most direct test for this gap. The key logic fix is inCheckIdenticalNullabilityVisitor#visitClassType, where we use the effective upper bound ofrhsTypewhen it is a wildcard or captured type. The change is otherwise a bit larger than expected to ensure checking doesn't break when the config setting to handle wildcards is disabled. We also extract thehaveIdenticalNullabilityfunction to de-duplicate some logic.Summary by CodeRabbit
Bug Fixes
Tests
Documentation