-
Notifications
You must be signed in to change notification settings - Fork 692
(DO NOT MERGE) SONARJAVA-4539 Fix FP on S1602 in lambda when curly braces are required to avoid ambiguity #5127
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
base: master
Are you sure you want to change the base?
Conversation
843394d
to
91feaad
Compare
99c9dd1
to
add1d21
Compare
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.
It looks good. I just have some style comments.
Optional<Arguments> argumentList = Optional.ofNullable(argument.parent()) | ||
.filter(Arguments.class::isInstance) | ||
.map(Arguments.class::cast); | ||
|
||
if(argumentList.isPresent()) { |
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 would prefer if (argument.parent() instance of Arguments argumentList)
which is more succinct
return argumentList | ||
.map(Tree::parent) | ||
.filter(MethodInvocationTree.class::isInstance) | ||
.map(MethodInvocationTree.class::cast) | ||
.map(mit -> new InvocationData(mit.methodSymbol(), position)); |
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.
Same thing: if (argumentList.parent() instance MethodInvocationTree mit)
/** | ||
* Given a collection of method symbols, get the distinct types possible at {@code position}. | ||
*/ | ||
private static Stream<Type> getTypesAtPos(Collection<Symbol> symbols, int position) { |
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.
getTypesAtPosition
} | ||
|
||
/** | ||
* Given a collection of method symbols, get the distinct types possible at {@code position}. |
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.
this should mention that it's the position among the parameters
SONARJAVA-4539