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

Bug 361436

Summary: TypeCastException on function $Plus(lvalue EAny in, rvalue EList in) in EList
Product: z_Archived Reporter: broy2
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas, pharmon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description broy2 CLA 2011-10-19 13:01:49 EDT
program arrayPlus type BasicProgram {}
	myNames string[] = ["Carolina", "State", "Duke"];
	element string = "Meredith";
	newList1 string[];
	newList2 string[];	
	function main()
		newList1 = myNames + element;		//  Works
		try
		newList2 = element + myNames;		//  Croaks
		onException(oops anyexception)
			SysLib.writeStdout(oops.message);
		end
	end
end

The value [Carolina, State, Duke] of type java.util.ArrayList cannot be converted to the type org.eclipse.edt.runtime.java.eglx.lang.EString.
eglx.lang.TypeCastException The value [Carolina, State, Duke] of type java.util.ArrayList cannot be converted to the type org.eclipse.edt.runtime.java.eglx.lang.EString.
	at eglx.lang.AnyException.fillInStackTrace(AnyException.java:187)
	at java.lang.Throwable.<init>(Throwable.java:181)
	at java.lang.Exception.<init>(Unknown Source)
	at java.lang.RuntimeException.<init>(Unknown Source)
	at eglx.lang.AnyException.<init>(AnyException.java:32)
	at eglx.lang.TypeCastException.<init>(TypeCastException.java:24)
	at org.eclipse.edt.runtime.java.eglx.lang.EAny.ezeCast(EAny.java:100)
	at org.eclipse.edt.runtime.java.eglx.lang.EString.ezeCast(EString.java:63)
	at pkg.arrayPlus.main(arrayPlus.java:42)
	at org.eclipse.edt.javart.resources.RunUnitBase.start(RunUnitBase.java:244)
	at pkg.arrayPlus.main(arrayPlus.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.edt.javart.ide.MainProgramLauncher.main(MainProgramLauncher.java:68)
Comment 1 Jeff Douglas CLA 2011-10-21 16:09:25 EDT
This looks like incorrect EGL to me. Brian agreed.

I'm putting this over to the compiler, so that it can be validated out as incorrect EGL.
Comment 2 Paul Harmon CLA 2011-10-24 08:53:36 EDT
The second case should insert the string as the first element of the array.

I am sending this back to javagen. The ReorgCode class should turn this into an InsertElement, just like it turns the first contenation in this example into an ApplendElement
Comment 3 Jeff Douglas CLA 2011-10-26 14:09:41 EDT
fixed
Comment 4 broy2 CLA 2011-11-03 11:25:02 EDT
Verified in 20111103 build.