mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: pull up: fix qualified super reference (IDEA-248954)
GitOrigin-RevId: 4fb054b73e9849a80504d65f560f7ce7af88b84c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
60203fa2a1
commit
330156602c
@@ -769,6 +769,7 @@ public class JavaPullUpHelper implements PullUpHelper<MemberInfo> {
|
||||
|
||||
@Override
|
||||
public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
super.visitReferenceExpression(expression);
|
||||
if(expression.getQualifierExpression() instanceof PsiSuperExpression) {
|
||||
PsiElement resolved = expression.resolve();
|
||||
if (resolved == null || resolved instanceof PsiMethod && shouldFixSuper((PsiMethod) resolved)) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Super {
|
||||
public String delegate;
|
||||
}
|
||||
|
||||
class Inner extends Super {
|
||||
public void b<caret>ar() {
|
||||
super.delegate.substring(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Super {
|
||||
public String delegate;
|
||||
|
||||
public void bar() {
|
||||
delegate.substring(0);
|
||||
}
|
||||
}
|
||||
|
||||
class Inner extends Super {
|
||||
}
|
||||
@@ -202,6 +202,10 @@ public class PullUpTest extends LightRefactoringTestCase {
|
||||
doTest(false, new RefactoringTestUtil.MemberDescriptor("bar", PsiMethod.class, true));
|
||||
}
|
||||
|
||||
public void testSuperFieldReferenced() {
|
||||
doTest(false, new RefactoringTestUtil.MemberDescriptor("bar", PsiMethod.class, false));
|
||||
}
|
||||
|
||||
public void testOuterClassRefs() {
|
||||
doTest(false, "Method <b><code>bar()</code></b> uses field <b><code>Outer.x</code></b>, which is not moved to the superclass", new RefactoringTestUtil.MemberDescriptor("bar", PsiMethod.class));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user