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

Bug 362856

Summary: Runtime errors accessing values from an array
Product: z_Archived Reporter: Will Smythe <smythew>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: chenzhh, hjiyong, jeffdouglas, svihovec, xiaobinc
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
test project - see test.egl under "client" package
none
Fix for js gen
lasher: iplog+
Another example of a runtime error accessing and casting a value in an array
none
Box elements of any type array literal lasher: iplog+

Description Will Smythe CLA 2011-11-03 22:55:53 EDT
Created attachment 206440 [details]
test project - see test.egl under "client" package

I have been playing with DojoDialogLib for awhile now and have never had any problems with it, but it's failing with the following message when calling showAlert or showMessage (these are the only 2 functions I have tried so far):

[CRRUI1070E] An 'undefined' is not an object exception occurred while processing the call back function. Use the try...OnException.
'undefined' is not an object
[CRRUI2094E] Here are the EGL function calls leading to this error:

    DojoButton.DojoButton.setOnClick() [native JavaScript]
    com/mycompany/test/client/test.egl() at line 48
    RUI Runtime.Handling callback for com.mycompany.test.server.testServ() [native JavaScript]
    RUI Runtime.Response for com.mycompany.test.server.testServ() [native JavaScript]

[CRRUI1071E] No exception handler found for service call. Add an exception handler for service call.
[CRRUI3655E] An error occurred while processing response object: '[CRRUI1070E] An 'undefined' is not an object exception occurred while processing the call back function. Use the try...OnException.'
[CRRUI2095E] Could not find the EGL function calls leading to this error

[CRRUI1071E] No exception handler found for service call. Add an exception handler for service call.
[CRRUI3660E] Exception occurred, could not handle response for 'com.mycompany.test.server.testServ', reason: '[CRRUI1071E] No exception handler found for service call. Add an exception handler for service call.'
[CRRUI2095E] Could not find the EGL function calls leading to this error

[type=eglx.lang.AnyException, message=[CRRUI1071E] No exception handler found for service call. Add an exception handler for service call.]
undefined:0
[CRRUI2095E] Could not find the EGL function calls leading to this error


I am using the Nov 3 build.
Comment 1 Will Smythe CLA 2011-11-03 22:56:29 EDT
Marking as major since this could be a larger JS generator/runtime issue .. the code in DojoDialogLib is pretty simple and has always worked.
Comment 2 Will Smythe CLA 2011-11-03 23:01:49 EDT
Launching this same app in an external browser (Chrome) results in the following message:

Uncaught ReferenceError: functionName is not defined
firstproject/runtime/egl_development.js:583
[CRRUI2095E] Could not find the EGL function calls leading to this error

Line 583 of egl_development.js is:
  egl.println("Internal error inside egl.leave "+functionName+" 

which is a line contained within: egl.leave = function() { ... }
Comment 3 Xiao Bin Chen CLA 2011-11-04 04:09:09 EDT
This is a JS generator problem:
If you define widget in a function and add event handler in xxx{ xxx}. The problem will show.


    ui GridLayout{columns = 3, rows = 4, cellPadding = 4, children = [ Button ]};
    Button Button{ layoutData = new GridLayoutData{ row = 2, column = 2 }, text="Button", onClick ::= Button_onClick };

    function start()
    end
    
    function Button_onClick(event Event in)
    	abt button{onClick = [Button_onClic]};
    end
    
    function Button_onClic(event Event in)
    end
Comment 4 Huang Ji Yong CLA 2011-11-07 05:33:44 EST
Created attachment 206512 [details]
Fix for js gen

Fix the problem of the last comment of xiao bin.
The event setting within another event handler is supported now.
Still have some problem in the widget part.
Comment 5 Xiao Bin Chen CLA 2011-11-08 02:55:25 EST
I have looked into the problem jiyong mentioned. It's not a widget problem , but a problem with operator "isa"  , There is a defect opened with same problem.
Bug 357974 - ClassCastException when generating Array Access 

I think we need to retrieve all of condition which used "isa" operator.
Comment 6 Will Smythe CLA 2011-11-11 11:25:28 EST
Created attachment 206862 [details]
Another example of a runtime error accessing and casting a value in an array

In the attached GridAccessExample.egl file, you will find a simple DataGrid that fires a selection event when a row is selected. The gridSelected() function is properly called, but if you debug you'll notice the local variable "d" is never getting assigned the dictionary (representing the selected row).

I have other examples where I am never able to 'cast' something in the selection or data of a grid into its real type (e.g. CustomerRecord, Dictionary, etc).

As alluded to below, this appears to be part of a bigger issue.
Comment 7 Will Smythe CLA 2011-11-11 11:30:21 EST
One final quick example:

handler RealSimpleTest type RUIhandler { initialUI = [  ], onConstructionFunction = start }

    function start()
    	a any[] = [ 1, 3, "string", 4];
    	syslib.writeStdout("A index 1: " + a[1] as int);    	
    end
    
end

Results in:

Could not render UI
'undefined' is not an object
[CRRUI2094E] Here are the EGL function calls leading to this error:

    client/RealSimpleTest.egl() at line 15
    RealSimpleTest.<init>() [native JavaScript]

TypeError: 'undefined' is not an object
undefined:0
[CRRUI2095E] Could not find the EGL function calls leading to this error
Comment 8 Huang Ji Yong CLA 2011-11-13 08:16:02 EST
Created attachment 206898 [details]
Box elements of any type array literal
Comment 9 Huang Ji Yong CLA 2011-11-13 08:56:09 EST
Resolved by changing arrayLiteralTemplate
Comment 10 Will Smythe CLA 2011-11-17 20:50:00 EST
Works now.