Bug 203061 - [compiler] Uninitialized member variables used in nonstatic initializers of peer members don't trigger compilation error
Summary: [compiler] Uninitialized member variables used in nonstatic initializers of p...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3.2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-12 08:44 EDT by Hollis Waite CLA
Modified: 2008-01-24 07:11 EST (History)
4 users (show)

See Also:
philippe_mulet: pmc_approved+


Attachments
Proposed patch (58.63 KB, patch)
2007-09-13 04:50 EDT, Philipe Mulet CLA
no flags Details | Diff
Patch for 3.3.x (40.93 KB, patch)
2007-09-13 06:57 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.