mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[java-inspection] IDEA-252155 False positive "Lambda can be replaced with method reference" when casting with additional bounds
GitOrigin-RevId: 2b752e6b47a0d53b05b4e7cd98064c5ce54e2904
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7e453a814d
commit
d833da5281
@@ -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, Object> fn = s -> (Cloneable & Serializable)<caret>s;
|
||||
}
|
||||
}
|
||||
@@ -280,6 +280,7 @@ public class LambdaCanBeMethodReferenceInspection extends AbstractBaseJavaLocalI
|
||||
}
|
||||
PsiType type = typeElement.getType();
|
||||
if (type instanceof PsiPrimitiveType || PsiUtil.resolveClassInType(type) instanceof PsiTypeParameter) return null;
|
||||
if (type instanceof PsiIntersectionType) return null;
|
||||
return new MethodReferenceCandidate(expression, true, javaSettings.REPLACE_INSTANCEOF_AND_CAST);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user