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

Bug 358996

Summary: Records in an any type array cannot access its field
Product: z_Archived Reporter: Huang Ji Yong <hjiyong>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: greer
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Huang Ji Yong CLA 2011-09-26 23:18:19 EDT
The test case:
package client;

// RUI Handler

//
//

handler testRecord type RUIhandler{initialUI =[
            ], onConstructionFunction = start, cssFile = "css/testIR.css", title = "testRecord"}
	data any[];

    function start()    	
		data = [
			new myRec { field1 = "Row 1, Column 1", field2 = "Row 1, Column 2"},
			new myRec { field1 = "Row 2, Column 1", field2 = "Row 2, Column 2"}
		];
		// Both will cause runtime error.	
		syslib.writeStdout(data[1].field1);
		syslib.writeStdout((data[1] as myRec).field1);
	end
end

Record myRec
	field1 String;
	field2 String;
end

Ideally, data[1].field1 and data[1]["field1"] should be supported because DataGrid depends on it.
Comment 1 Scott Greer CLA 2011-10-19 20:21:08 EDT
Ji Yong,

Both of these types of dynamic access work for me: 

        syslib.writeStdout(data[1].field1);
        syslib.writeStdout(data[1]["field2"]);
Comment 2 Huang Ji Yong CLA 2011-10-21 00:32:11 EDT
The second one syslib.writeStdout((data[1] as myRec).field1); still has runtime error.
The runtime function egl.convertAnyToRefType returns null in this test case.

This error may be related to bug 360498
Comment 3 Huang Ji Yong CLA 2011-11-14 03:31:42 EST
Resolved when resolving bug 359218
Comment 4 Huang Ji Yong CLA 2011-11-17 02:58:21 EST
Verified in build 201111160901