Summary: | [compiler] Erroneous blank field may not have been initialized | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Nikolay Metchev <nikolaymetchev> | ||||||||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||||
Severity: | normal | ||||||||||||
Priority: | P3 | CC: | hwaite, Olivier_Thomann | ||||||||||
Version: | 3.4 | ||||||||||||
Target Milestone: | 3.5 M6 | ||||||||||||
Hardware: | PC | ||||||||||||
OS: | Windows XP | ||||||||||||
Whiteboard: | |||||||||||||
Attachments: |
|
Description
Nikolay Metchev
2008-12-05 09:49:57 EST
Reproduced with HEAD. All javac versions seem to compile without an error. This is a regression introduced in 3.3.2. Bug most likely introduced when fixing bug 203061 More detailed testcase: public class X { final int hello; public X() { hello = 0; new Object() { int i = hello; }; } public X(int i) { new Object() { int j = hello; }; } } 1. We should blame 'int j = hello;' but not 'int i = hello;. 2. We should not blame constructor X(int i) for missing init for #hello. Before 3.3.2, we did behave ok for (1), but not for (2). Now we are wrong for both (1) and (2). Erratum: Error (2) is legite. Added InitializationTest#test196-203 Created attachment 124145 [details]
Proposed patch
Fix for bug 203061 did surface this one; as prior to fix for 203061 we wouldn't even check for initialization status within anonymous type. Since 3.3.2 we did, but there was an inconsistency for retrieving the initialization flow info that now became apparent. i.e. prior to 203061 we would not reject invalid code; after 3.3.2 we were rejecting valid code in certain corner cases. Created attachment 124147 [details]
Better patch
Previous patch did not handle presence of generics properly
Released for 3.5M6. Fixed Created attachment 124163 [details]
Proposed patch for 3.4
Created attachment 124259 [details]
Proposed patch for 3.3
Released into 3.3.x branch Released into 3.4.x branch (post 3.4.2) Verified for 3.5M6 using I20090310-0100 *** Bug 275246 has been marked as a duplicate of this bug. *** |