mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-91844 Groovy: "Method may be static" inspection doesn't report methods which have references to static members from other classes
This commit is contained in:
+1
@@ -130,6 +130,7 @@ public class GrMethodMayBeStaticInspection extends BaseInspection {
|
||||
|
||||
GroovyPsiElement resolveContext = result.getCurrentFileResolveContext();
|
||||
if (resolveContext != null) return;
|
||||
if (element instanceof PsiClass && ((PsiClass)element).getContainingClass() == null) return;
|
||||
if (element instanceof PsiMember && !((PsiMember)element).hasModifierProperty(PsiModifier.STATIC)) {
|
||||
myMay = false;
|
||||
}
|
||||
|
||||
+19
@@ -70,4 +70,23 @@ class A {
|
||||
myFixture.enableInspections(GrMethodMayBeStaticInspection)
|
||||
myFixture.checkHighlighting(true, false, false)
|
||||
}
|
||||
|
||||
void testOtherClasses() {
|
||||
myFixture.with {
|
||||
addFileToProject('Fooo.groovy', '''\
|
||||
class Fooo {
|
||||
static def foo() {}
|
||||
}
|
||||
''')
|
||||
configureByText('_.groovy', '''\
|
||||
class Bar {
|
||||
static def abc()
|
||||
def bar() {
|
||||
abc()
|
||||
Fooo.foo()
|
||||
}
|
||||
}
|
||||
''')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user