mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 05:51:25 +07:00
lambda -> method ref: do not suggest to replace anonymous classes (IDEA-93588)
This commit is contained in:
@@ -115,6 +115,7 @@ public class LambdaCanBeMethReferenceInspection extends BaseJavaLocalInspectionT
|
||||
if (psiMethod == null) {
|
||||
isConstructor = true;
|
||||
if (!(methodCall instanceof PsiNewExpression)) return null;
|
||||
if (((PsiNewExpression)methodCall).getAnonymousClass() != null) return null;
|
||||
final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)methodCall).getClassOrAnonymousClassReference();
|
||||
if (classReference == null) return null;
|
||||
containingClass = (PsiClass)classReference.resolve();
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Replace lambda with method reference" "false"
|
||||
class NonStaticInner3 {
|
||||
class Foo {
|
||||
}
|
||||
|
||||
interface I1<X> {
|
||||
X m();
|
||||
}
|
||||
|
||||
{
|
||||
I1<Foo> b2 = () -> <caret>new Foo(){};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user