mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
pull up: update references in hierarchy for static methods in interfaces
IDEA-186590
This commit is contained in:
@@ -328,6 +328,9 @@ public class JavaPullUpHelper implements PullUpHelper<MemberInfo> {
|
||||
if (qualifierExpression instanceof PsiReferenceExpression && ((PsiReferenceExpression)qualifierExpression).resolve() == mySourceClass) {
|
||||
((PsiReferenceExpression)qualifierExpression).bindToElement(myTargetSuperClass);
|
||||
}
|
||||
else if (qualifierExpression == null && myTargetSuperClass.isInterface()) {
|
||||
((PsiReferenceExpression)element).setQualifierExpression(JavaPsiFacade.getElementFactory(myProject).createReferenceExpression(myTargetSuperClass));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
class Foo {}
|
||||
class FooImpl extends Foo {
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
public static void foo(){}
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
interface Foo {}
|
||||
class FooImpl implements Foo {
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
public static void foo(){}
|
||||
<caret>
|
||||
}
|
||||
class U {
|
||||
public static void main(String[] args) {
|
||||
FooImpl.foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
interface Foo {
|
||||
static void foo(){}
|
||||
}
|
||||
class FooImpl implements Foo {
|
||||
{
|
||||
Foo.foo();
|
||||
}
|
||||
|
||||
}
|
||||
class U {
|
||||
public static void main(String[] args) {
|
||||
Foo.foo();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ class Foo {
|
||||
public static void foo(){}
|
||||
}
|
||||
class FooImpl extends Foo {
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
}
|
||||
class U {
|
||||
|
||||
@@ -141,6 +141,10 @@ public class PullUpTest extends LightRefactoringTestCase {
|
||||
doTest(false, new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class));
|
||||
}
|
||||
|
||||
public void testUpdateStaticRefsForInterface() {
|
||||
doTest(false, new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class));
|
||||
}
|
||||
|
||||
public void testRemoveOverrideFromPulledMethod() {
|
||||
doTest(false, new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user