diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethod.java b/core/src/main/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethod.java index 0066f20a643..9c260482391 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethod.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/PrimitiveArrayPassedToVarargsMethod.java @@ -50,9 +50,16 @@ public Description matchMethodInvocation(MethodInvocationTree t, VisitorState st } /** - * Assuming the argument in the varargs position is a single one of type int[], here is the truth - * table: Param type Should return Why int... false Exact type match int[]... false Exact type - * match for the array element type T... true Will cause boxing Object... true Will cause boxing + * Assuming the argument in the varargs position is a single one of type {@code int[]}, here is + * the truth table: + * + *
+   *     Param type    Should return     Why
+   *     int...        false             Exact type match
+   *     int[]...      false             Exact type match for the array element type
+   *     T...          true              Will cause boxing
+   *     Object...     true              Will cause boxing
+   * 
*/ private static boolean isVarargs(MethodInvocationTree tree, VisitorState state) { MethodSymbol symbol = ASTHelpers.getSymbol(tree); @@ -62,7 +69,7 @@ private static boolean isVarargs(MethodInvocationTree tree, VisitorState state) return false; } - // Last param must be varags + // Last param must be varargs List params = symbol.getParameters(); int varargsPosition = params.size() - 1; ArrayType varargsParamType = (ArrayType) getLast(params).type;