mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
change signature: fix reorder & making varargs at one step (IDEA-153052)
This commit is contained in:
@@ -186,9 +186,10 @@ public class JavaChangeInfoImpl extends UserDataHolderBase implements JavaChange
|
||||
}
|
||||
else {
|
||||
final ParameterInfoImpl lastNewParm = this.newParms[this.newParms.length - 1];
|
||||
obtainsVarags = lastNewParm.isVarargType();
|
||||
retainsVarargs = lastNewParm.oldParameterIndex >= 0 && obtainsVarags;
|
||||
arrayToVarargs = retainsVarargs && oldParameterTypes[lastNewParm.oldParameterIndex].endsWith("[]");
|
||||
boolean isVarargs = lastNewParm.isVarargType();
|
||||
obtainsVarags = isVarargs && lastNewParm.oldParameterIndex < 0;
|
||||
retainsVarargs = lastNewParm.oldParameterIndex >= 0 && oldParameterTypes[lastNewParm.oldParameterIndex].endsWith("...") && isVarargs;
|
||||
arrayToVarargs = lastNewParm.oldParameterIndex >= 0 && oldParameterTypes[lastNewParm.oldParameterIndex].endsWith("[]") && isVarargs;
|
||||
}
|
||||
|
||||
if (isNameChanged) {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
void <caret>foo(String[] s, int a) {}
|
||||
|
||||
{
|
||||
foo("a", 1);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
void foo(int a, String... s) {}
|
||||
|
||||
{
|
||||
foo(1, "a");
|
||||
}
|
||||
}
|
||||
@@ -357,6 +357,13 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
|
||||
}, false);
|
||||
}
|
||||
|
||||
public void testReorderWithVarargsFromSimpleType() {
|
||||
doTest(null, new ParameterInfoImpl[]{
|
||||
new ParameterInfoImpl(1),
|
||||
new ParameterInfoImpl(0, "s", myFactory.createTypeFromText("java.lang.String...", getFile()))
|
||||
}, false);
|
||||
}
|
||||
|
||||
public void testIntroduceParameterWithDefaultValueInHierarchy() {
|
||||
doTest(null, new ParameterInfoImpl[]{new ParameterInfoImpl(-1, "i", PsiType.INT, "0")}, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user