mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-152933 (Return of instance of anonymous, local or inner class shall ignore static methods)
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -86,7 +86,7 @@ public class ReturnOfInnerClassInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiMethod method = PsiTreeUtil.getParentOfType(statement, PsiMethod.class, true, PsiLambdaExpression.class);
|
||||
if (method == null || method.hasModifierProperty(PsiModifier.PRIVATE)) {
|
||||
if (method == null || method.hasModifierProperty(PsiModifier.PRIVATE) || method.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
return;
|
||||
}
|
||||
else if (ignoreNonPublic &&
|
||||
|
||||
+4
@@ -1,5 +1,9 @@
|
||||
public class ReturnOfInnerClass {
|
||||
|
||||
public static Object zero() {
|
||||
return new Object() {};
|
||||
}
|
||||
|
||||
public Object one() {
|
||||
<warning descr="Return of instance of anonymous class">return</warning> new Object() {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user