From afb39182bb2d211ed81301b2ccf9a1813c9e2c1b Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 6 Mar 2019 17:58:10 +0100 Subject: [PATCH] IG: clarify description --- .../AssignmentToForLoopParameter.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/AssignmentToForLoopParameter.html b/plugins/InspectionGadgets/src/inspectionDescriptions/AssignmentToForLoopParameter.html index 7e3650dd0987..163af3d227d9 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/AssignmentToForLoopParameter.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/AssignmentToForLoopParameter.html @@ -2,7 +2,19 @@ Reports assignment to, or modification of for statement parameters inside the for loop body. While occasionally intended, this construct can be extremely confusing, and is often the result of a typo. -Assignments in plain for loops without an update statement are not reported. +

+Assignments in basic for loops without an update statement are not reported. +In these cases the assignment is probably intended and can't be easily moved to the update part of the for loop. +For example: +


+  for (int i = 0; i < list.size(); ) {
+    if (element.equals(list.get(i))) {
+      list.remove(i);
+    } else {
+      i++; // modification of for loop parameter
+    }
+  }
+