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

Bug 359218

Summary: TreeNode appendChild js generation cause runtime error
Product: z_Archived Reporter: Huang Ji Yong <hjiyong>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Testcase
none
widget change
lasher: iplog+
Fix for the js problem lasher: iplog+

Description Huang Ji Yong CLA 2011-09-28 08:28:09 EDT
Test case attached.
The error message:
Could not render UI
[CRRUI1055E] The null child cannot be added to the [CRRUI1050E] The DIV variable must include the word "null". variable.
[CRRUI2094E] Here are the EGL function calls leading to this error:

    Div.Widget.getTagName() [native JavaScript]
    Div.Widget.appendChild() [native JavaScript]
    org/eclipse/edt/rui/widgets/TreeNode.egl() at line 72

Uncaught [type=eglx.lang.AnyException, message=[CRRUI1055E] The null child cannot be added to the [CRRUI1050E] The DIV variable must include the word "null". variable.]
testWidget/client/testTree.html?contextKey=146:90
[CRRUI2095E] Could not find the EGL function calls leading to this error
-------------
The error is caused by the generation of TreeNode.egl line 72
childrenContainer.appendChild(child);
The generated code is
this.childrenContainer.appendChild(egl.eglx.lang.EAny.ezeCast(child, egl.eglx.ui.rui.Widget));

In which egl.eglx.lang.EAny.ezeCast returns a null value. (the function is defined in BaseTypesAndRuntimes.js, so maybe we have to change js runtime)
Comment 1 Huang Ji Yong CLA 2011-09-28 08:28:36 EDT
Created attachment 204176 [details]
Testcase
Comment 2 Huang Ji Yong CLA 2011-10-25 01:12:52 EDT
Scott has started to do this bug, so assign it back to him
Comment 3 Huang Ji Yong CLA 2011-11-03 04:30:59 EDT
Created attachment 206386 [details]
widget change

This test case can be simplified to 
    div Div{};

    function start()
    	buttons any[] = [new Button{text = "button"}];
    	addChild(buttons[1]);
    end
    function addChild(child any in)
    	div.appendChild(child);
    end

The problem happens when the function parameter is any type, and the argument is from a any array.
Since I can update the TreeNode.egl to bypass this defect, and this defect is not common and blocking, so I downgrade the severity.
Comment 4 Huang Ji Yong CLA 2011-11-03 04:32:37 EDT
This bug may be the same as bug 358996
Comment 5 Huang Ji Yong CLA 2011-11-14 03:27:59 EST
Created attachment 206923 [details]
Fix for the js problem

The literal in the any type array is boxed now.
Comment 6 Huang Ji Yong CLA 2011-11-14 03:28:57 EST
Fixed.
The literal in the any type array is boxed now.
Comment 7 Huang Ji Yong CLA 2011-11-17 02:59:03 EST
Verified in build 201111160901