| Summary: | ClassCastException when generating an array access | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Brian Svihovec <svihovec> | ||||
| Component: | EDT | Assignee: | Project Inbox <edt.javascriptgen-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | greer | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 202001 [details]
Simle ArrayAccess testcase.
Brian, Verified the fix you provided and committed it. Closing this defect. |
Create a package named pack1 and import the attached EGL file. When the file is run with the JS Generator, a ClassCastException is thrown on the array access. I believe the fix is to change ArrayAccessTemplate::genExpression to the following, but I am not positive: public void genExpression(ArrayAccess expr, Context ctx, TabbedWriter out) { Field field = null; if(expr.getArray() instanceof Name){ if (((Name) expr.getArray()).getNamedElement() instanceof Field) field = (Field) ((Name) expr.getArray()).getNamedElement(); } if (field != null && field.getContainer() != null && field.getContainer() instanceof Type) ctx.invoke(genContainerBasedArrayAccess, (Type) field.getContainer(), ctx, out, expr, field); else genArrayAccess(expr, ctx, out); }