IPP: fix AIOOBE

This commit is contained in:
Bas Leijdekkers
2018-07-13 12:48:59 +03:00
parent 9a84fd2caf
commit 1a4a5c09bb
2 changed files with 17 additions and 1 deletions

View File

@@ -60,7 +60,7 @@ class VarargArgumentsPredicate implements PsiElementPredicate {
if (!JavaGenericsUtil.isReifiableType(substitutedType)) {
return false;
}
if (arguments.length > parameters.length) {
if (arguments.length != parameters.length) {
return true;
}
final PsiExpression lastExpression = arguments[arguments.length - 1];

View File

@@ -105,4 +105,20 @@ public class WrapVarargArgumentsWithExplicitArrayIntentionTest extends IPPTestCa
"}"
);
}
public void testEmptyArray() {
doTest(
"class X {" +
" void x() {" +
" java.util.Arrays.asList(/*_Wrap vararg arguments with explicit array creation*/);" +
" }" +
"}",
"class X {" +
" void x() {" +
" java.util.Arrays.asList(new Object[]{});" +
" }" +
"}"
);
}
}