Repository navigation
Fix issue with reading annotations on record constructor parameters due to javac bug - #1636
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
WalkthroughUpdates Possibly related PRs
Suggested labels: 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 |
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/NullabilityUtil.java`:
- Around line 368-370: Update the isDirectTypeUseAnnotation call in the
parameter annotation check to pass varSymbol instead of symbol, so nesting
checks evaluate the parameter’s type. Remove the redundant NullabilityUtil.
qualifier since the call is within NullabilityUtil.
🪄 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
Run ID: 229808c0-31cf-4af2-93d9-41be2b64040b
📒 Files selected for processing (3)
nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.javanullaway/src/test/java/com/uber/nullaway/TypeUseAnnotationsTests.javanullaway/src/test/java/com/uber/nullaway/jspecify/JSpecifyArrayTests.java
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1636 +/- ##
============================================
+ Coverage 88.20% 88.21% +0.01%
- Complexity 3075 3076 +1
============================================
Files 105 105
Lines 10293 10296 +3
Branches 2087 2087
============================================
+ Hits 9079 9083 +4
Misses 573 573
+ Partials 641 640 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Main Branch: With This PR: |
Due to a bug in
javacin JDK 17-26 (fixed in openjdk/jdk#29928), sometimes type use annotations appear on record constructor parameters with positionFIELD(specifically, when a compact record constructor is used). We work around that bug by also looking for type use annotations on the type of the symbol for the parameter. Previously this would not work for parameters from bytecode, but it works now on the most recent versions of JDK 17 and 21 with the flag-XDaddTypeAnnotationsToSymbol=truepassed tojavac. As it requires a significant hack to fix this otherwise, and it only impacts checking outside JSpecify mode, I'm not inclined to try to fix for when-XDaddTypeAnnotationsToSymbol=trueis not passed.Fixes #1631