From 239c72d5fb373f17d250db2c302a0b9415ff8cf2 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 20 Nov 2013 17:37:24 +0100 Subject: [PATCH] add examples to description --- .../SuspiciousToArrayCall.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousToArrayCall.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousToArrayCall.html index 1d3eadae9021..fa435b715dab 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousToArrayCall.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousToArrayCall.html @@ -1,8 +1,22 @@ Reports two types of suspicious calls to Collection.toArray(). -The first type is calls where the type of the specified array argument is not of the same type as the array type to which the result is casted. -The second type is calls where the type of the specified array argument does not match the type parameter of the collection declaration. +The first type is any calls where the type of the specified array argument is not of the same type as the array type to which the result is casted. +Example: +

+void m(List list) {
+  Number[] ns = (Number[])
+      list.toArray(new String[list.size()]);
+}
+
+The second type is any calls where the type of the specified array argument does not match the type parameter of the collection declaration. +Example: +

+void m(List<Number> list) {
+  Number[] ns =
+      list.toArray(new String[list.size()]);
+}
+