method duplicates: pass array 2 vararg method call ( IDEA-53635)

This commit is contained in:
anna
2010-05-21 10:03:11 +04:00
parent 06e808e881
commit 6af63745e1
4 changed files with 32 additions and 1 deletions
@@ -153,7 +153,9 @@ public final class Match {
}
if (isVararg) {
if (!parameterType.isAssignableFrom(type)) return false;
currentValue.add(value);
if (!((PsiEllipsisType)psiVariable.getType()).toArrayType().equals(type)){
currentValue.add(value);
}
}
myParameterOccurences.get(psiVariable).add(value);
return true;
@@ -0,0 +1,13 @@
class Test {
public void print<caret>Array(String... p) {
System.out.println(p[0]);
System.out.println(p[1]);
}
public void doSmth() {
String[] arr = {"smth1", "smth2", "smth3"};
System.out.println(arr[0]);
System.out.println(arr[1]);
}
}
@@ -0,0 +1,12 @@
class Test {
public void printArray(String... p) {
System.out.println(p[0]);
System.out.println(p[1]);
}
public void doSmth() {
String[] arr = {"smth1", "smth2", "smth3"};
printArray(arr);
}
}
@@ -33,4 +33,8 @@ public class FindMethodDuplicatesMiscTest extends FindMethodDuplicatesBaseTest {
public void testParametersModification() throws Exception {
doTest();
}
public void testPassArray2VarargMethodCall() throws Exception {
doTest();
}
}