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

Bug 355746

Summary: Implement array language changes
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P1 CC: greer
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matt Heitz CLA 2011-08-24 12:33:32 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 Scott Greer CLA 2011-09-15 11:06:41 EDT
Critical for SVT entry.
Comment 2 Scott Greer CLA 2011-09-22 15:23:06 EDT
This work was intertwined with the https://bugs.eclipse.org/bugs/show_bug.cgi?id=355741.....but it appears the only array-specific change that I needed was to correctly handle null arrays as well as nullable elements.

Verified that all 35 of the tests passed, regression-tested with FVT tests.
Comment 3 Matt Heitz CLA 2011-10-03 11:05:37 EDT
Closing.