Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: the following code show an erroneous blank final field may not have been initialized compiler error: public class AnnonymousInnerComplainsAboutFinalMember { final int hello; public AnnonymousInnerComplainsAboutFinalMember() { hello = 0; new Object() { int i = hello; }; } } More information:
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. ***