Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359161 - Convert to widget type by "as widget" causes runtime error
Summary: Convert to widget type by "as widget" causes runtime error
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-27 21:44 EDT by Huang Ji Yong CLA
Modified: 2017-02-23 14:14 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-27 21:44:51 EDT
The test case:
package client;

// RUI Handler

import org.eclipse.edt.rui.widgets.Div;

//
//

handler testAsWidget type RUIhandler{initialUI =[div], onConstructionFunction = start, cssFile = "css/testBugs.css", title = "testAsWidget"}

//   	div Div{ children = [new Div {innerText = "my inner div"} ]};
	div Div{ children = [new Div {innerText = "my inner div"} as Widget ]};
    function start()
    end
end

The generated js for the line of as Widget is
this.div.setChildren([egl.eglx.ui.rui.Widget.fromWidget(eze$Temp1,"Torg/eclipse/edt/rui/widgets/Div;")].setType("Teglx/ui/rui/Widget;"));
In which, fromWidget is not defined at egl.eglx.ui.rui.Widget.

The Shadow widget suffers from this defect. We can have a workaround for Shadow, so mark this defect as normal.
Comment 1 Scott Greer CLA 2011-09-28 15:14:35 EDT
Caused by a dubious conversion defined in Widget.egl:

	static function asWidget(value Widget in) returns(Widget) {@Operation{"widen"}};


We're afraid this may be necessary due to some quirk or limitation in the type infrastructure, so I'm leaving it in place and have added a no-op implementation to the JS runtime;  I've flagged it with a TODO to question the need for this (non-)conversion and remove it -- and my impl. -- if appropriate.
Comment 2 Huang Ji Yong CLA 2011-10-21 00:42:55 EDT
Verified in 201110202102