Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357017 - Curly braces don't cause instantiation
Summary: Curly braces don't cause instantiation
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jeff Douglas CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-07 17:46 EDT by Matt Heitz CLA
Modified: 2017-02-23 14:19 EST (History)
0 users

See Also:


Attachments

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