mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
[java-inspections] Avoid isInstance conversion for invalid type element
Fixes EA-429448 - AE: LambdaCanBeMethodReferenceInspection.lambda$getLambdaToMethodReferenceConversionCandidate$0 GitOrigin-RevId: 689dc8501700e55feb56f8ae31278cf237265c5c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
256a6e090a
commit
4577e3c4bf
@@ -0,0 +1,6 @@
|
||||
// "Replace lambda with method reference" "false"
|
||||
class X {
|
||||
void test() {
|
||||
Predicate<Object> predicate = c -> c <caret>instanceof String.;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class LambdaCanBeMethodReferenceInspection extends AbstractBaseJavaLocalInspectionTool {
|
||||
private static final Logger LOG = Logger.getInstance(LambdaCanBeMethodReferenceInspection.class);
|
||||
@@ -411,7 +412,7 @@ public class LambdaCanBeMethodReferenceInspection extends AbstractBaseJavaLocalI
|
||||
else if (element instanceof PsiInstanceOfExpression) {
|
||||
if(isSoleParameter(parameters, ((PsiInstanceOfExpression)element).getOperand())) {
|
||||
PsiTypeElement type = ((PsiInstanceOfExpression)element).getCheckType();
|
||||
if(type != null) {
|
||||
if(type != null && !PsiUtilCore.hasErrorElementChild(type)) {
|
||||
return type.getText() + ".class::isInstance";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user