Bug 203061

Summary: [compiler] Uninitialized member variables used in nonstatic initializers of peer members don't trigger compilation error
Product: [Eclipse Project] JDT Reporter: Hollis Waite <hwaite>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_audel, jerome_lanneluc, Olivier_Thomann, remy.suen
Version: 3.3Flags: philippe_mulet: pmc_approved+
Target Milestone: 3.3.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Patch for 3.3.x none

Description Hollis Waite CLA 2007-09-12 08:44:48 EDT
Build ID: I20070621-1340

Steps To Reproduce:
The following code raises a compile error with the standard JDK:

public final class Test {
 private final Object mObj;
 private final Object mDependent = new Object() {
  {Object o = mObj;}
 };
 public Test() {mObj = "";}
}


More information:
Expected result:

Test.java:4: variable mObj might not have been initialized
        private final Object mMap = new Object() {{Object o = mObj;}};
                                                              ^
Comment 1 Olivier Thomann CLA 2007-09-12 11:45:22 EDT
Reproduced with HEAD.
Comment 2 Philipe Mulet CLA 2007-09-13 04:05:13 EDT
Added InitializationTest#test192-193, GenericTypeTest#test1163-1164.
Comment 3 Philipe Mulet CLA 2007-09-13 04:50:12 EDT
Created attachment 78286 [details]
Proposed patch
Comment 4 Philipe Mulet CLA 2007-09-13 04:50:56 EDT
Indeed the check needs to be performed in nested initialization contexts as well.
Comment 5 Philipe Mulet CLA 2007-09-13 04:55:05 EDT
Released for 3.4M2
Comment 6 Philipe Mulet CLA 2007-09-13 06:57:18 EDT
Created attachment 78296 [details]
Patch for 3.3.x
Comment 7 David Audel CLA 2007-09-18 06:19:04 EDT
Verified for 3.4M2 using build I20070917-0010
Comment 8 Philipe Mulet CLA 2007-10-10 04:28:56 EDT
considering for 3.3.2
Comment 9 Philipe Mulet CLA 2007-10-10 04:29:07 EDT
Released for 3.3.2
Fixed
Comment 10 Maxime Daniel CLA 2007-10-29 12:43:55 EDT
Only adding Verified for 3.4M2 to the status whiteboard, since I believe this
got lost.
Comment 11 Jerome Lanneluc CLA 2007-11-22 10:42:38 EST
This is a bug we have had since day 1, but quite severe.
Fix is safe.
Comment 12 Philipe Mulet CLA 2007-11-23 09:19:58 EST
+1 for 3.3.2
Comment 13 Frederic Fusier CLA 2008-01-24 07:11:05 EST
Verified for 3.3.2 using build M20080123-0800.