Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357017

Summary: Curly braces don't cause instantiation
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Jeff Douglas <jeffdouglas>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matt Heitz CLA 2011-09-07 17:46:28 EDT
Curly braces will no longer make a variable not be null.  Only an initializer or assignment can do that.


The set-values block is only a set-values block; it no longer creates an instance of a type. 

Each of the following variations creates an instance, and they are equally efficient::

	b Button {text ="abc"};
	b Button = new Button {text = "abc"};
	b Button? = new Button{text = "abc"};
	b Button {text = "abc"} = new Button{text="xyz"};  

In the last example, only fields can be in the second block; annotations cannot.  Any assignments to fields in the first block are ignored.

You cannot assign a value to a nullable variable that was not initialized.  The following examples are not valid: 

	b Button? {text = "abc"};   // is an error because of the set-values block (setting a field of a null variable).
	b Button? {text = "abc"}  = new Button {text = "xyz"};   // is also an error because of the leftmost set-values block.

The errors will be caught at compile time.
Comment 1 Matt Heitz CLA 2011-09-19 08:24:10 EDT
Changing the target milestone since we're in I-15 now.  This is probably done, but the testcase is currently blocked by bug 358102.
Comment 2 Jeff Douglas CLA 2011-09-21 11:23:35 EDT
this looks done to me
Comment 3 Matt Heitz CLA 2011-09-26 21:49:41 EDT
This is done.
Comment 4 Matt Heitz CLA 2011-09-27 10:16:52 EDT
Closing all JavaGen enhancements that are in the Resolved state.