Fix NPE in AtmLubVisitor for captured types in switch expressions#7435
Fix NPE in AtmLubVisitor for captured types in switch expressions#7435Suvrat1629 wants to merge 1 commit intotypetools:masterfrom
Conversation
📝 WalkthroughWalkthroughThis change addresses a null pointer exception that occurred during least upper bound computation when processing switch expressions containing method references. A regression test file was added to verify the fix, and defensive null checks were implemented in the Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-11-02T02:18:00.536ZApplied to files:
🔇 Additional comments (4)
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 |
|
Thanks for your pull request. We appreciate it. Although you describe this as a fix, the pull request does not correct the underlying problem, which is that an I agree that users should not see the crash -- and in that sense this pull request has value -- but I would prefer to correct the underlying defect rather than masking it. By the way, your commit has a human name of "Suvrat1629" rather than "Suvrat Acharya". To prevent this in the future, please do one or both of the following:
|
|
@mernst Ok that makes it more clearer, there was nothing much specified in the issue so I thought we were to prevent the crash. I'll take a look at this issue in more detail. Thanks for the response. |
Fixed a Checker Framework crash (NPE in
AnnotationUtils.annotationName) when computing LUB for captured type variables from wildcard capture.The bug occurred because primary annotations were lost on bounds during special-case handling for captured types/wildcards in
lubWildcard.Fix: After merging bounds in
lubWildcard, explicitly calllubPrimaryAnnotationson the upper bound to propagate qualifiers correctly when one side lacks primaries.This prevents null annotations in hierarchies, eliminating the crash.
Added test
checker/tests/nullness/Test6872.javathat previously crashed and now passes cleanly.Fixes #6872