mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inline super class: fix this qualifier for nested/anonymous classes in constructors (IDEA-194883)
This commit is contained in:
@@ -326,12 +326,7 @@ public class ChangeContextUtil {
|
||||
PsiThisExpression thisExpr = (PsiThisExpression)scope;
|
||||
if (thisExpr.getQualifier() == null){
|
||||
if (thisClass instanceof PsiAnonymousClass) return null;
|
||||
PsiThisExpression qualifiedThis = RefactoringChangeUtil.createThisExpression(thisClass.getManager(), thisClass);
|
||||
if (thisExpr.getParent() != null) {
|
||||
return thisExpr.replace(qualifiedThis);
|
||||
} else {
|
||||
return qualifiedThis;
|
||||
}
|
||||
return RefactoringChangeUtil.createThisExpression(thisClass.getManager(), thisClass);
|
||||
}
|
||||
}
|
||||
else if (!(scope instanceof PsiClass)){
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
protected final Object myBar;
|
||||
protected final Object myBizz;
|
||||
|
||||
public Test() {
|
||||
this.myBar = new Object() {
|
||||
};
|
||||
this.myBizz = null;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Super {
|
||||
protected final Object myBar;
|
||||
protected final Object myBizz;
|
||||
|
||||
protected Super() {
|
||||
myBar = new Object() {
|
||||
};
|
||||
myBizz = null;
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class Test extends Super{
|
||||
public Test() {
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,7 @@ public class InlineSuperClassTest extends MultiFileTestCase {
|
||||
public void testOneAndKeepReferencesInAnotherInheritor() {
|
||||
doTest(false, true);
|
||||
}
|
||||
public void testThisQualificationInsideAnonymous() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
doTest(false, false);
|
||||
|
||||
Reference in New Issue
Block a user