qualify statically imported methods if they conflict with local members (IDEA-156273)

This commit is contained in:
Anna.Kozlova
2016-05-20 18:52:45 +02:00
parent 601acf7ee4
commit 3226d3e996
8 changed files with 78 additions and 2 deletions
@@ -0,0 +1,6 @@
package bar;
public class Bar {
public static Object bar() {
return new Object();
}
}
@@ -0,0 +1,8 @@
package foo;
import bar.Bar;
public class Foo {
protected static Object bar() {
return Bar.bar();
}
}
@@ -0,0 +1,10 @@
package foo;
import bar.Bar;
public class Foo {
protected static Object bar(int i) {
return Bar.bar();
}
static void bar(int i, int j) {}
}
@@ -0,0 +1,6 @@
package bar;
public class Bar {
public static Object createBar() {
return new Object();
}
}
@@ -0,0 +1,7 @@
package foo;
import static bar.Bar.createBar;
public class Foo {
protected static Object bar() {
return createBar();
}
}
@@ -0,0 +1,9 @@
package foo;
import static bar.Bar.createBar;
public class Foo {
protected static Object bar(int i) {
return createBar();
}
static void bar(int i, int j) {}
}
@@ -97,6 +97,10 @@ public class RenameMethodMultiTest extends MultiFileTestCase {
doTest("p.Foo", "void foo()", "bar");
}
public void testExpandStaticImportToAvoidConflictingResolve() throws Exception {
doTest("bar.Bar", "void createBar()", "bar");
}
private void doTest(final String methodSignature, final String newName) throws Exception {
doTest(getTestName(false), methodSignature, newName);
}