Back to Intellij Community

PrimitiveArrayArgumentToVariableArgMethod

java/java-impl/resources/inspectionDescriptions/PrimitiveArrayArgumentToVariableArgMethod.html

2025.3-rc-2466 B
Original Source

Reports any calls to a variable arity method where the call has one primitive-type array in the variable arity parameter position. Such a primitive-array argument may be confusing, as it will be wrapped in a single-element array argument, rather than each element being a separate argument, as may be expected.

Example:

String.format("%s", new int[]{1, 2, 3});

After the quick-fix is applied:

String.format("%s", (Object) new int[]{1, 2, 3});