Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357974 - ClassCastException when generating Array Access
Summary: ClassCastException when generating Array Access
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: Yun Feng Ma CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-16 14:20 EDT by Brian Svihovec CLA
Modified: 2017-02-23 14:20 EST (History)
4 users (show)

See Also:


Attachments
Testcase. (1.14 KB, application/octet-stream)
2011-09-16 14:20 EDT, Brian Svihovec CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Svihovec CLA 2011-09-16 14:20:03 EDT
Created attachment 203511 [details]
Testcase.

Import the attached handler.

When it generates, you get the following exception:

org.eclipse.edt.mof.codegen.api.TemplateException: java.lang.ClassCastException: org.eclipse.edt.mof.egl.impl.ArrayAccessImpl cannot be cast to org.eclipse.edt.mof.egl.Name
	at org.eclipse.edt.mof.codegen.api.TemplateContext.doInvoke(TemplateContext.java:384)
	at org.eclipse.edt.mof.codegen.api.TemplateContext.invoke(TemplateContext.java:260)
	at org.eclipse.edt.gen.javascript.templates.AssignmentStatementTemplate.genStatementBody(AssignmentStatementTemplate.java:21)
	at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.edt.mof.codegen.api.TemplateContext.doInvoke(TemplateContext.java:357)
	at org.eclipse.edt.mof.codegen.api.TemplateContext.invoke(TemplateContext.java:260)
	at org.eclipse.edt.gen.javascript.templates.StatementTemplate.genStatement(StatementTemplate.java:25)
	at org.eclipse.edt.gen.javascriptdev.templates.StatementTemplate.genStatement(StatementTemplate.java:26)
	at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.edt.mof.codegen.api.TemplateContext.doInvoke(TemplateContext.java:357)
	at org.eclipse.edt.mof.codegen.api.TemplateContext.invoke(TemplateContext.java:260)

Caused by: java.lang.ClassCastException: org.eclipse.edt.mof.egl.impl.ArrayAccessImpl cannot be cast to org.eclipse.edt.mof.egl.Name
	at org.eclipse.edt.gen.javascript.templates.AssignmentTemplate.genExpression(AssignmentTemplate.java:35)
	at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.edt.mof.codegen.api.TemplateContext.doInvoke(TemplateContext.java:357)
	... 131 more
Comment 1 Brian Svihovec CLA 2011-09-16 15:09:48 EDT
This blocks the RUI Technical Sample.
Comment 2 Brian Svihovec CLA 2011-09-30 22:39:57 EDT
There is no longer a generation error with this particular test case, but I am still having an issue with the sample application where this defect was found.  I realize that the defect has not been marked as resolved yet, so this new issue may already be known.  If it is not known, let me know if you want another defect.  The details are:

I tried the Tic Tac Toe demo in the org.eclipse.edt.rui.samples_0.7.0 project, and there appears to be an issue if you drop more than one symbol on the grid.  I added some trace statements to the Board::getImageID(n int) function, and I am getting the following results for the first time a symbol is dropped:

Box 1 has no children
Box 2 has no children
Box 3 has no children
Box 4 has no children
Box 5 has no children
Box 6 has children
Box 7 has no children
Box 8 has no children
Box 9 has no children
Box 1 has no children
Box 4 has no children
Box 7 has no children
Box 2 has no children
Box 5 has no children
Box 8 has no children
Box 3 has no children
Box 6 has children
Box 9 has no children
Box 1 has no children
Box 5 has no children
Box 9 has no children
Box 3 has no children
Box 5 has no children
Box 7 has no children


and I am getting the following results the second time a symbol is dropped:

Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Box [type=eglx.lang.AnyBoxedObject] has no children
Comment 3 Scott Greer CLA 2011-10-01 11:09:31 EDT
Brian,

The original problem was common to both generators so I worked with Jeff to identify the root cause and he fixed it in both Java and JavaScript.  

However, as you've noted, the problem is still unresolved;  I think it has to do with both generators lacking logic for handling type conversions involving arrays.  I'm somewhat familiar with RBD's logic, but the "original intent" wasn't very clear so exactly how that translates to EDT is still to be determined.  

So obviously Jeff and I have more work to do on this defect....
Comment 4 Yun Feng Ma CLA 2011-11-16 09:19:43 EST
Now the Tic Tac Toe works fine, resolve this bug. Thanks.
Comment 5 Brian Svihovec CLA 2011-11-30 13:19:28 EST
20111130 build.
Comment 6 Brian Svihovec CLA 2011-11-30 13:20:21 EST
Closing.