make class static: leave super expressions unprocessed when they do not correspond to outer class (IDEA-72740)

This commit is contained in:
anna
2011-08-03 22:02:14 +04:00
parent b973627301
commit 11538de335
4 changed files with 50 additions and 1 deletions
@@ -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();}