mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
TrivialFunctionalExpressionUsageInspection: support parentheses for anonymous class
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// "Replace call with method body" "true"
|
||||
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
public class Main {
|
||||
public void call() {
|
||||
switch((0)) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Replace call with method body" "true"
|
||||
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
public class Main {
|
||||
public void call() {
|
||||
switch((new IntSupplier() {public int getAsInt() { return 0;}}.getA<caret>sInt())) {}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class TrivialFunctionalExpressionUsageInspection extends AbstractBaseJava
|
||||
if (returnStatements.length > 1) {
|
||||
return false;
|
||||
}
|
||||
final PsiElement callParent = call.getParent();
|
||||
final PsiElement callParent = PsiUtil.skipParenthesizedExprUp(call.getParent());
|
||||
return callParent instanceof PsiStatement ||
|
||||
callParent instanceof PsiLocalVariable;
|
||||
}, newExpression, aClass.getBaseClassType(), new ReplaceAnonymousWithLambdaBodyFix());
|
||||
|
||||
Reference in New Issue
Block a user