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

Bug 363990

Summary: JS: AS operator not casting from index of any[] into record during assignment
Product: z_Archived Reporter: Will Smythe <smythew>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P1 CC: hjiyong, svihovec, tww
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
RUI handler demonstrating the problem
none
fix lasher: iplog+

Description Will Smythe CLA 2011-11-16 20:45:06 EST
Created attachment 207120 [details]
RUI handler demonstrating the problem

I thought this defect was already known, but can't find it. 

The issue can be seen in the attached handler code. I am doing a fairly simple cast from the selected row in a grid (grid.getSelection(), which returns an any[]) into a concrete record type (Customer). Although debug shows the array returned by getSelection() is correct, I cannot assign this any into a Customer.

Here is an example of the problem:
	sels any[] = grid.getSelection(); // in debug, sels[] correct contains the selected Customer record
    	c1 Customer = sels[1] as Customer; // c1 is an empty record (PROBLEM) - fields never getting assigned any values
Comment 1 Huang Ji Yong CLA 2011-11-17 01:37:22 EST
Created attachment 207126 [details]
fix
Comment 2 Huang Ji Yong CLA 2011-11-17 01:38:40 EST
Change ArrayTypeTemplate to fix array to any type array conversion
Comment 3 Will Smythe CLA 2011-11-17 21:06:55 EST
Looks good.