Fix null dereference and FalseBoundException crash in type argument inference; fixes #7681#7735
Conversation
typetools#7681 - In Typing.java reduceSubtypeClass(), null-check the result of asSuper() before calling capture() on it. - In InvocationTypeInference.java getB4(), catch FalseBoundException from reduceAdditionalArgOnce() and continue gracefully.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR: (1) guards against a null dereference in Typing.reduceSubtypeClass by checking asSuper before capture, (2) wraps reduceAdditionalArgOnce in InvocationTypeInference.getB4 with a try/catch for FalseBoundException and skips failing additional-arg constraints, and (3) adds checker/tests/nullness/java8inference/Issue7681.java, a regression test exercising nested generics, lambdas, and a method reference. Possibly related issues
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
Hi @mernst, this PR fixes the two crashes reported in #7681 (NPE in Typing.java and FalseBoundException in InvocationTypeInference.java). All functional CI jobs pass (junit, inference, typecheck, nonjunit). The misc_jdk25 and misc_jdk26 failures are maybe pre-existing — ./gradlew requireJavadoc fails on upstream/master itself with the same 1189 violations, none of which were introduced by this PR. Would you be able to review? |
smillst
left a comment
There was a problem hiding this comment.
This pull request does not fix the issue. It converts it to a different exception and then ignores the exception.
PR Description:
error: [type.argument.inference.crashed] Type argument inference crashed
error: An exception occurred: Cannot invoke "AbstractType.capture(...)"
because the return value of "AbstractType.asSuper(...)" is null
Fixes: #7681