Repository navigation
Add a self-contained test case for #1157 - #1289
Conversation
WalkthroughA new public test method, atomicReferenceFieldUpdaterSelfContained(), was added to GenericMethodTests. The test injects a self-contained Java snippet using makeHelperWithInferenceFailureWarning() to validate NullAway with JSpecify models around AtomicReferenceFieldUpdater.newUpdater and related @Nullable/@nonnull generic type bounds. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1289 +/- ##
============================================
+ Coverage 88.34% 88.37% +0.02%
- Complexity 2465 2467 +2
============================================
Files 93 93
Lines 8188 8188
Branches 1614 1614
============================================
+ Hits 7234 7236 +2
+ Misses 480 479 -1
+ Partials 474 473 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodTests.java (2)
1209-1215: Consider declaring the referenced field for claritySince the stub uses "result" as the field name, adding a matching field improves readability and mirrors real usage (no behavior change).
Apply this diff within the snippet:
- "public class Test {", + "public class Test {", + " @Nullable Object result;", " static class AtomicReferenceFieldUpdater<T, V extends @Nullable Object> {",
1211-1212: Tiny style nit: add spaces after commas in type paramsKeeps consistency with surrounding code.
- " public static <U,W extends @Nullable Object> AtomicReferenceFieldUpdater<U,W> ", + " public static <U, W extends @Nullable Object> AtomicReferenceFieldUpdater<U, W> ",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodTests.java(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: msridhar
PR: uber/NullAway#1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
📚 Learning: 2025-08-14T18:50:06.159Z
Learnt from: msridhar
PR: uber/NullAway#1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
Applied to files:
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodTests.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build and test on windows-latest
- GitHub Check: Build and test on ubuntu-latest
- GitHub Check: Build and test on macos-latest
- GitHub Check: Build spring-framework with snapshot
🔇 Additional comments (1)
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodTests.java (1)
1197-1218: Self‑contained repro for #1157 looks goodNice isolation of the inference behavior without relying on JDK models; aligns with our preference to fail (not skip) when environment is insufficient. No functional issues spotted.
Inference works now for code like that of #1157 but the original test case doesn't work since we still lack JSpecify JDK models (#950). This PR adds a self-contained test case (not using the standard library) to show that inference now works correctly for this case.
Summary by CodeRabbit