Community
Participate
Working Groups
This is a follow up to https://bugs.eclipse.org/bugs/show_bug.cgi?id=176283. Simplified test case: void foo(List<Object> l, boolean b) { for (Object o: l) { if (b) { if (o != null) { return; } } else { System.out.println(o.toString()); // warning here } } } Contrast with: void bar(List<Object> l, boolean b) { Iterator<Object> i = l.iterator(); Object o; while (i.hasNext()) { o = i.next(); if (b) { if (o != null) { return; } } else { System.out.println(o.toString()); // silent } } }
Created attachment 61788 [details] Fix + test case ForeachStatement#analyseCode now marks the index of the loop as definitely unknown.
Released for 3.3M7.
Verified for 3.3M7 using I20070427-0010