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

Bug 355747

Summary: Implement array language changes
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Jeff Douglas <jeffdouglas>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P1    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matt Heitz CLA 2011-08-24 12:33:45 EDT
This work needs to be completed in Iteration 13.  Prioritize it ahead of other
enhancements, even if they'll have to be pushed out of the iteration.

[The following is the section on Array Declarations from
http://wiki.eclipse.org/EDT:EGL_Language_Statements.]


Arrays can't be declared with an initial size
---------------------------------------------
Arrays can't be declared with an initial size. The size of an array isn't part of its type. That's why in RBD you can declare an int[5] and then assign [1,2,3] to it -- you change its length from 5 to 3. In EDT, all arrays must be declared without an initial size.

A size is still allowed on a new expression when you create an array.

Here are some example array declarations for EDT:

    a int[] = new int[3];
    a int[] = [1, 2, 3];
    a int[]; // This is an array of length zero.
    a int[]?; // Initially null.
    a int[]? {}; // This is an array of length zero. 


Initializing arrays with literals
---------------------------------
Array initializers must be efficient. "a int[] = [1, 2, 3];" means make an array of three elements, values 1 then 2 then 3. Do not make a zero-length array, then make an array from the literal, and throw away the original zero-length array.


Initializing arrays with set-values blocks
------------------------------------------
A set-values block on an array declaration causes the values within the block to be appended to the array. For example "a int[] { 1, 2, 3 };" results in [1, 2, 3]. The block has a different effect in RBD: it sets elements rather than appending them, so you'd get an index out of bounds exception on the declaration "a int[] { 1, 2, 3 };".
Comment 1 Matt Heitz CLA 2011-09-19 08:24:00 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 Matt Heitz CLA 2011-09-26 21:50:08 EDT
This is done.
Comment 3 Matt Heitz CLA 2011-09-27 10:16:52 EDT
Closing all JavaGen enhancements that are in the Resolved state.