mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 21:41:24 +07:00
[java-inspections] LambdaCanBeMethodReference: avoid conversion to cast on invalid type
Fixes EA-429448 - AE: LambdaCanBeMethodReferenceInspection.lambda$getLambdaToMethodReferenceConversionCandidate$0 GitOrigin-RevId: 51471968b691b383659da01bad4360493a04e46e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b0f2917632
commit
97472fc470
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "false"
|
||||
import java.util.function.Function;
|
||||
|
||||
class Bar extends Random {
|
||||
public void test(Object obj) {
|
||||
Function<Object, String> fn = s -> (String.)<caret>s;
|
||||
}
|
||||
}
|
||||
@@ -456,7 +456,7 @@ public class LambdaCanBeMethodReferenceInspection extends AbstractBaseJavaLocalI
|
||||
PsiTypeCastExpression castExpression = (PsiTypeCastExpression)element;
|
||||
if(isSoleParameter(parameters, castExpression.getOperand())) {
|
||||
PsiTypeElement type = castExpression.getCastType();
|
||||
if (type != null) {
|
||||
if (type != null && !PsiUtilCore.hasErrorElementChild(type)) {
|
||||
return type.getText() + ".class::cast";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user