| Summary: | Using the ** operator doesn't do an implicit conversion to int | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Kathy Carroll <carrollk> |
| Component: | EDT | Assignee: | Project Inbox <edt.javagen-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jeffdouglas, mheitz |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
I believe the way to fix the bad cast is to generate expr.intValue() not (int)expr when the expr is nullable. In place of casts to other types, use shortValue, longValue, floatValue, or doubleValue. *** Bug 356249 has been marked as a duplicate of this bug. *** See the testcase in Bug 355754 for another case where this problem shows up. (The same solution ought to work for it.) Whoops, I should've written "See the testcase in Bug 356249" in that last comment. This will be fixed once Paul fixes the problem of getting the right type of a binary expression. Paul and I investigated further and it is not a type return problem in his code, but it's because the EGL definition files don't match the runtime w.r.t. using objects or primitives. Once these match up, this error goes away. this was fixed by a combination of other bug reports and fixing the runtime definitions works in 201109161325 Closing this defect. |
I get these this Java error Cannot cast from Double to int not these lines of java intActual = (int)((org.eclipse.edt.runtime.java.egl.lang.ESmallint.power((short) 5, (short) 3))) intActual2 = (int)((EInt.power(int1, int2))) when generating this program: program driver type BasicProgram {} intExpect int = 125; function main() try1(); try2(); try3(); end function try1() intActual int = 5 ** 3; end function try2() int1 int = 5; int2 int = 3; intActual2 int = int1 ** int2; end function try3() int1 int = 5; int2 int = 3; result float = int1 ** int2; intActual int = result; end end