mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
abstract method call in constructor: don't warn inside lambda body
This commit is contained in:
+1
-1
@@ -150,7 +150,7 @@ public class MethodCallUtils {
|
||||
}
|
||||
|
||||
public static boolean isCallDuringObjectConstruction(PsiMethodCallExpression expression) {
|
||||
final PsiMember member = PsiTreeUtil.getParentOfType(expression, PsiMethod.class, PsiClassInitializer.class, PsiField.class);
|
||||
final PsiMember member = PsiTreeUtil.getParentOfType(expression, PsiMember.class, true, PsiClass.class, PsiLambdaExpression.class);
|
||||
if (member == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
abstract class A {
|
||||
public A() {
|
||||
Runnable r = () -> foo();
|
||||
Runnable r1 = new Runnable() {
|
||||
public void run() {
|
||||
foo();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
abstract void foo();
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.siyeh.ig.initialization;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
|
||||
public class AbstractMethodCallInConstructorInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void testAbstractMethodCallInConstructor() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new AbstractMethodCallInConstructorInspection();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user