distinguish usageInfos corresponding to one poly reference

static import on overload method should be updated when all overloads are renamed simultaneously (IDEA-142445)
This commit is contained in:
Anna.Kozlova
2017-03-20 17:05:33 +01:00
parent 6a4b4df690
commit 0a889aa880
6 changed files with 62 additions and 0 deletions
@@ -0,0 +1,9 @@
package pack1;
public class A {
public static void renamedStaticMethod(int i) {
}
public static void renamedStaticMethod(String s) {
}
}
@@ -0,0 +1,11 @@
package pack2;
import pack1.A;
import static pack1.A.renamedStaticMethod;
class Usage {
{
A.renamedStaticMethod(27);
}
}
@@ -0,0 +1,9 @@
package pack1;
public class A {
public static void staticMethod(int i) {
}
public static void staticMethod(String s) {
}
}
@@ -0,0 +1,9 @@
package pack2;
import static pack1.A.staticMethod;
class Usage {
{
staticMethod(27);
}
}
@@ -61,6 +61,10 @@ public class RenameMethodMultiTest extends MultiFileTestCase {
doTest("pack1.A", "void staticMethod(int i)", "renamedStaticMethod");
}
public void testStaticImport5() throws Exception {
doAutomaticRenameMethod("pack1.A", "void staticMethod(int i)", "renamedStaticMethod");
}
public void testDefaultAnnotationMethod() throws Exception {
doTest("pack1.A", "int value()", "intValue");
}
@@ -86,6 +86,26 @@ public class MoveRenameUsageInfo extends UsageInfo{
return myReferencedElement;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
MoveRenameUsageInfo info = (MoveRenameUsageInfo)o;
if (myReferencedElement != null ? !myReferencedElement.equals(info.myReferencedElement) : info.myReferencedElement != null) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (myReferencedElement != null ? myReferencedElement.hashCode() : 0);
return result;
}
@Override
@Nullable
public PsiReference getReference() {