Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358996 - Records in an any type array cannot access its field
Summary: Records in an any type array cannot access its field
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: ---   Edit
Assignee: Huang Ji Yong CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-26 23:18 EDT by Huang Ji Yong CLA
Modified: 2017-02-23 14:20 EST (History)
1 user (show)

See Also:


Attachments

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