mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
redundant lambda code block: check void compatible lambdas for ambiguity conflicts
This commit is contained in:
@@ -77,7 +77,7 @@ public class RedundantLambdaCodeBlockInspection extends BaseJavaBatchLocalInspec
|
||||
if (body instanceof PsiCodeBlock) {
|
||||
PsiExpression psiExpression = getExpression((PsiCodeBlock)body);
|
||||
if (psiExpression != null && !findCommentsOutsideExpression(body, psiExpression)) {
|
||||
if (!expression.isVoidCompatible() && LambdaUtil.isExpressionStatementExpression(psiExpression)) {
|
||||
if (LambdaUtil.isExpressionStatementExpression(psiExpression)) {
|
||||
final PsiElement parent = PsiUtil.skipParenthesizedExprUp(expression.getParent());
|
||||
if (parent instanceof PsiExpressionList) {
|
||||
final PsiElement gParent = parent.getParent();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// "Replace with expression lambda" "false"
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
Set<String> strings = new HashSet<>();
|
||||
new Test().query(pResultSet -> <caret>{
|
||||
strings.add("Col1");
|
||||
});
|
||||
}
|
||||
|
||||
public void query(RowCallbackHandler rch){
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
public Object query( final ResultSetExtractor rse) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
interface RowCallbackHandler {
|
||||
void processRow(ResultSet var1);
|
||||
}
|
||||
|
||||
interface ResultSetExtractor {
|
||||
Object extractData(ResultSet var1);
|
||||
}
|
||||
class ResultSet {}
|
||||
Reference in New Issue
Block a user