mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-115516 (Multiple warnings local foreach parameter can be final)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>NestedForeach.java</file>
|
||||
<line>9</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Local variable or parameter can be final</problem_class>
|
||||
<description>Variable <code>s</code> can have <code>final</code> modifier</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
class NestedForeach {
|
||||
void foo(final List<String> list) {
|
||||
new Object() {
|
||||
void one() {
|
||||
new Object() {
|
||||
void two() {
|
||||
new Object() {
|
||||
void three() {
|
||||
for (String s : list) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -129,4 +129,10 @@ public class LocalCanBeFinalTest extends InspectionTestCase {
|
||||
myTool.REPORT_VARIABLES = false;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNestedForeach() throws Exception {
|
||||
myTool.REPORT_VARIABLES = true;
|
||||
myTool.REPORT_PARAMETERS = false;
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user