-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSpecify: handling the return of a diamond operator anonymous object method caller #858
JSpecify: handling the return of a diamond operator anonymous object method caller #858
Conversation
… operator object is calling a method
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #858 +/- ##
============================================
+ Coverage 86.93% 86.95% +0.01%
- Complexity 1888 1890 +2
============================================
Files 74 74
Lines 6215 6216 +1
Branches 1208 1209 +1
============================================
+ Hits 5403 5405 +2
Misses 405 405
+ Partials 407 406 -1
☔ View full report in Codecov by Sentry. |
// TODO: support diamond operators | ||
return Nullness.NONNULL; | ||
} | ||
} | ||
Type methodReceiverType = | ||
castToNonNull( | ||
getTreeType(((MemberSelectTree) tree.getMethodSelect()).getExpression(), state)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding all the code above, why not just store the result of this getTreeType()
call in a local variable, and if it is null
, return Nullness.NONNULL
? That is more general I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I added it in the same condition, does this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to do it after that condition and store the result of getTreeType()
in a local variable, so we don't call it twice. Otherwise the logic looks good.
…_caller_abhijitk' into jspecify_diamond_operator_method_caller_abhijitk
In reference to the exception mentioned in the discussion for #791 .
Adding the test case to reproduce the same issue:
All unit tests have passed for the changes that were made for this.