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

Bug 355262

Summary: Template Exception thrown when processing the AS statement
Product: z_Archived Reporter: Brian Svihovec <svihovec>
Component: EDTAssignee: 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:

Description Brian Svihovec CLA 2011-08-19 15:35:04 EDT
Create a file named AnyTemplateTest.egl

Add the following EGL Source:

//
Handler AnyTemplateTest type RUIWidget {}
	 
	nodeContainer Widget { 
		  children = [ ], 
		paddingLeft = 12, style="text-align: left;",
		background = "url(images/TreeNodeL.gif) no-repeat" 
	}; 
	outerContainer Widget { 
		children = [ nodeContainer as Widget ], 
		background = "url(images/TreeNodeI.gif) repeat-y"
	};
	  
	function main()
	end 
end

Save and build the file with the JavaScript generator.

The following exception is thrown:

generating:test.AnyTemplateTest[test/AnyTemplateTest.egl]:(16)
org.eclipse.edt.mof.codegen.api.TemplateException: 
	at org.eclipse.edt.gen.EglContext.getPrimitiveMapping(EglContext.java:232)
	at org.eclipse.edt.gen.javascript.templates.egl.lang.AnyTypeTemplate.genConversionOperation(AnyTypeTemplate.java:34)
	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.mof.codegen.api.TemplateContext.doInvoke(TemplateContext.java:359)

I believe the fix is to replace line 32 of AnyTypeTemplate.java with:

if (ctx.getPrimitiveMapping(arg.getObjectExpr().getType().getClassifier().getTypeSignature()) == null) {
Comment 1 Scott Greer CLA 2011-09-10 15:45:19 EDT
Brian,

Looks like your fix is already committed, and I verified that the provided testcase gens, so I'm marking this one resolved;  re-open if necessary....thanks.
Comment 2 Brian Svihovec CLA 2011-09-12 22:08:26 EDT
Tested with the latest code from CVS and no exception is thrown.