mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make class static: leave super expressions unprocessed when they do not correspond to outer class (IDEA-72740)
This commit is contained in:
@@ -96,7 +96,9 @@ public class MakeStaticUtil {
|
||||
qualifier.resolve() : PsiTreeUtil.getParentOfType(element, PsiClass.class);
|
||||
if (refElement instanceof PsiClass) {
|
||||
if (isPartOf((PsiClass) refElement, containingClass)) {
|
||||
classRefs.add(new InternalUsageInfo(element, refElement));
|
||||
if (!(originalMember instanceof PsiClass && isPartOf((PsiClass)refElement, (PsiClass)originalMember))) {
|
||||
classRefs.add(new InternalUsageInfo(element, refElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
public class m {
|
||||
void aa(){}
|
||||
}
|
||||
|
||||
class Outer extends m{
|
||||
class I<caret>nner extends Super {
|
||||
void bar(){
|
||||
|
||||
}
|
||||
void foo() {
|
||||
super.foo();
|
||||
this.bar();
|
||||
Outer.super.aa();
|
||||
Outer.this.aa();
|
||||
}
|
||||
}
|
||||
}
|
||||
class Super {
|
||||
void foo() {}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
public class m {
|
||||
void aa(){}
|
||||
}
|
||||
|
||||
class Outer extends m{
|
||||
static class Inner extends Super {
|
||||
private Outer anObject;
|
||||
|
||||
public Inner(Outer anObject) {
|
||||
this.anObject = anObject;
|
||||
}
|
||||
|
||||
void bar(){
|
||||
|
||||
}
|
||||
void foo() {
|
||||
super.foo();
|
||||
this.bar();
|
||||
anObject.aa();
|
||||
anObject.aa();
|
||||
}
|
||||
}
|
||||
}
|
||||
class Super {
|
||||
void foo() {}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ public class MakeClassStaticTest extends LightCodeInsightTestCase {
|
||||
public void testIDEADEV12762() throws Exception { perform(); }
|
||||
|
||||
public void testNewExpressionQualifier() throws Exception {perform();}
|
||||
public void testThisSuperExpressions() throws Exception {perform();}
|
||||
|
||||
public void testNonDefaultConstructorAnonymousClass() throws Exception {perform();}
|
||||
public void testDefaultConstructorAnonymousClass() throws Exception {perform();}
|
||||
|
||||
Reference in New Issue
Block a user