check for list size: skiped varargs parameter (16666)

This commit is contained in:
anna
2009-10-29 12:40:06 +03:00
parent ce47db97bc
commit d2ba61a99e
4 changed files with 29 additions and 1 deletions
@@ -43,7 +43,7 @@ public class ChangeSignatureUtil {
if (elementsToRemove == null) {
elementsToRemove = new ArrayList<Child>();
for (int i = 0; i < shouldRemoveChild.length; i++) {
if (shouldRemoveChild[i]) {
if (shouldRemoveChild[i] && i < elements.size()) {
elementsToRemove.add(elements.get(i));
}
}
@@ -0,0 +1,12 @@
class Test {
void fo<caret>o(int i, int ... ja){
}
void bar() {
foo(0);
foo(0, 1);
foo(0, 1, 2);
foo(0, new int[]{3, 4});
foo(0, new int[0]);
}
}
@@ -0,0 +1,12 @@
class Test {
void foo(int i){
}
void bar() {
foo(0);
foo(0);
foo(0);
foo(0);
foo(0);
}
}
@@ -129,6 +129,10 @@ public class ChangeSignatureTest extends LightCodeInsightTestCase {
}, false);
}
public void testRemoveVarargParameter() throws Exception {
doTest(null, null, null, new ParameterInfoImpl[]{new ParameterInfoImpl(0)}, new ThrownExceptionInfo[0], false);
}
public void testEnumConstructor() throws Exception {
doTest(null, new ParameterInfoImpl[] {
new ParameterInfoImpl(-1, "i", PsiType.INT, "10")