mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Inline inner: outer class field access (IDEA-39208)
This commit is contained in:
@@ -197,10 +197,10 @@ public class ChangeContextUtil {
|
||||
refExpr.setQualifierExpression(factory.createReferenceExpression(containingClass));
|
||||
}
|
||||
}
|
||||
else if (thisAccessExpr != null){
|
||||
else {
|
||||
final PsiClass realParentClass = refExpr.getCopyableUserData(REF_MEMBER_THIS_CLASS_KEY);
|
||||
refExpr.putCopyableUserData(REF_MEMBER_THIS_CLASS_KEY, null);
|
||||
if (thisClass != null && realParentClass != null &&
|
||||
if (thisAccessExpr != null && thisClass != null && realParentClass != null &&
|
||||
InheritanceUtil.isInheritorOrSelf(thisClass, realParentClass, true)) {
|
||||
boolean needQualifier = true;
|
||||
PsiElement refElement = refExpr.resolve();
|
||||
|
||||
+5
-4
@@ -21,8 +21,6 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
import static com.intellij.patterns.PlatformPatterns.psiElement;
|
||||
import static com.intellij.patterns.PsiJavaPatterns.psiExpressionStatement;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
|
||||
@@ -40,6 +38,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.patterns.PlatformPatterns.psiElement;
|
||||
import static com.intellij.patterns.PsiJavaPatterns.psiExpressionStatement;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
@@ -153,8 +154,8 @@ class InlineToAnonymousConstructorProcessor {
|
||||
if (PsiTreeUtil.getChildrenOfType(anonymousClass, PsiMember.class) == null) {
|
||||
anonymousClass.deleteChildRange(anonymousClass.getLBrace(), anonymousClass.getRBrace());
|
||||
}
|
||||
ChangeContextUtil.decodeContextInfo(anonymousClass, anonymousClass, null);
|
||||
final PsiNewExpression superNewExpression = (PsiNewExpression) myNewExpression.replace(superNewExpressionTemplate);
|
||||
PsiNewExpression superNewExpression = (PsiNewExpression) myNewExpression.replace(superNewExpressionTemplate);
|
||||
superNewExpression = (PsiNewExpression)ChangeContextUtil.decodeContextInfo(superNewExpression, superNewExpression.getAnonymousClass(), null);
|
||||
JavaCodeStyleManager.getInstance(superNewExpression.getProject()).shortenClassReferences(superNewExpression);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ public class InlineToAnonymousClassTest extends LightCodeInsightTestCase {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void _testOuterClassFieldAccess() throws Exception {
|
||||
public void testOuterClassFieldAccess() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user