Summary: | [compiler] inconsistent handling of unreachable code | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Mandel <stefan.mandel> | ||||||
Component: | Core | Assignee: | Maxime Daniel <maxime_daniel> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P2 | CC: | jerome_lanneluc, kent_johnson, philippe_mulet | ||||||
Version: | 3.3 | Flags: | philippe_mulet:
pmc_approved+
kent_johnson: review+ |
||||||
Target Milestone: | 3.3.2 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Mandel
2007-08-16 05:03:37 EDT
Reproduced. Indeed this is inconsistent. Thanks for reporting it. This regression got introduced during 3.3. Likely a consequence of fix for bug 134848 Maxime - pls redo fix for bug 134848. It seems that the line "statementInfo.mergedWith(labelContext.initsOnBreak)" (in LabelStatement) should always be executed no matter what. Then the null info in some case could be managed separately afterwards. Currently the null info handling is breaking the standard flow analysis. I would also want a fix for 3.3.2. There should be no difference between the test() and test1(): import java.util.*; public class X { private static final boolean PREDICATE = false; public Object test() throws Exception { if (PREDICATE) { Iterator i = new HashSet().iterator(); // is not detected as unreachable test: while (i.hasNext()) { // the test:-Label is essential to reproduce this bug } return null; // is detected as unreachable } return null; } public Object test2() throws Exception { if (PREDICATE) { Iterator i = new HashSet().iterator(); // is not detected as unreachable while (i.hasNext()) {} return null; // is detected as unreachable } return null; } } Released FlowAnalysisTest#48 (inactive) and 49 in HEAD. Created attachment 78443 [details]
Suggested fix
Patch for HEAD. Tests pass. Kent could you please review it?
Released for 3.4 M3. Setting target to 3.3.2 per Philippe's comment #4. Reopening for 3.3.2. Created attachment 79879 [details]
R3_3_MAINTENANCE patch
Essentially porting the changes of the test infrastructure. The code change in core is the same as for HEAD.
Released for 3.3.2. Verified for 3.4M3 using I20071029-0010 build. Sorry, I should not have set this bug as VERIFIED... ...but set the status whiteboard instead! This is a regression introduced when adding support for null analysis. The regression affects mandatory flow analysis diagnosis (not optional null analysis). This is quite severe. +1 for 3.3.2 Verified for 3.3.2 using build M20080123-0800. |