Fix library models check for expression-body lambdas (Fixes #910) - #1603
Fix library models check for expression-body lambdas (Fixes #910)#1603dyrpsf wants to merge 1 commit into
Conversation
|
Caution Review failedPull request was closed or merged during review WalkthroughThis PR extends NullAway's handler plugin system with a new dataflow callback for assignment-node visitation. The core infrastructure adds Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 4❌ Failed checks (4 warnings)
✅ Passed checks (1 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 |
303e0e3 to
e55aca8
Compare
|
Closing this PR due to some technical issues, |
Title
Fix library models check for expression-body lambdas (Fixes #910)
Description
This PR addresses Issue #910, where NullAway was failing to report
RETURN_NULLABLEerrors for expression-body lambdas (e.g.,(x) -> null) when a library model overrides the return type to@NonNull.Motivation and Context
Previously,
matchLambdaExpressioncontained an early bailout if the implemented functional interface was unannotated. However, this early exit completely bypassed thecheckReturnExpressionstep, which is where library models (like Guava'sFunction) are evaluated to see if they override the return nullability.Specific Changes
matchLambdaExpressionto checkgetMethodReturnNullnessbefore exiting. If a library model forces the return to beNONNULL, the check continues even if the underlying functional interface is unannotated.NullAwayLambdaTests.javawith a specific test case to ensureFunction<Object, Object> f1 = (x) -> null;correctly triggers a bug diagnostic.Summary by CodeRabbit
New Features
Optional.of()andOptional.ofNullable()operations to better track non-null states.Bug Fixes
Optional.of().Tests
Optional.of()andOptional.ofNullable()initialization scenarios.