mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method duplicates: pass array 2 vararg method call ( IDEA-53635)
This commit is contained in:
@@ -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;
|
||||
|
||||
+13
@@ -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]);
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user