mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
introduce parameter: do not insert additional arg when selection was in the self call (IDEA-66896)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
void foo(boolean flag, int i, final int anObject) {
|
||||
if (flag) {
|
||||
foo(false, i, anObject);
|
||||
}
|
||||
System.out.println();
|
||||
foo(false, i, anObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
void foo(boolean flag, final String anObject, int... i) {
|
||||
if (flag) {
|
||||
foo(false, anObject, i);
|
||||
}
|
||||
System.out.println();
|
||||
foo(flag, anObject, i);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
void foo(final String anObject, int... i) {
|
||||
foo(anObject, 1);
|
||||
foo(anObject, 3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
void foo(boolean flag, int i) {
|
||||
if (flag) {
|
||||
foo(false, i, <selection>i + 1</selection>);
|
||||
}
|
||||
System.out.println();
|
||||
foo(false, i);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
void foo(boolean flag, int... i) {
|
||||
if (flag) {
|
||||
foo(false, <selection>""</selection>, i);
|
||||
}
|
||||
System.out.println();
|
||||
foo(flag, i);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
void foo(int... i) {
|
||||
foo(<selection>""</selection>, 1);
|
||||
foo(3);
|
||||
}
|
||||
}
|
||||
@@ -283,6 +283,18 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, true);
|
||||
}
|
||||
|
||||
public void testSelfReference() throws Exception {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
|
||||
}
|
||||
|
||||
public void testSelfReferenceVarargs() throws Exception {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
|
||||
}
|
||||
|
||||
public void testSelfReferenceVarargs1() throws Exception {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
|
||||
}
|
||||
|
||||
private void doTestThroughHandler() throws Exception {
|
||||
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
|
||||
boolean enabled = true;
|
||||
|
||||
Reference in New Issue
Block a user