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

Bug 329989

Summary: [EGL] Illegal assignment to variable 't'. Expected Template and found org.eclipse.epsilon.egl.EglTemplate
Product: [Modeling] Epsilon Reporter: Louis Rose <louis>
Component: CoreAssignee: Dimitris Kolovos <dkolovos>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Louis Rose CLA 2010-11-11 07:29:53 EST
When invoking EGL from Java, assignments to a template variable fail with the following error:

Illegal assignment to variable 't'. Expected Template and found org.eclipse.epsilon.egl.EglTemplate


Exemplar client code:

	public static void main(String[] args) {
		EglTemplateFactory tf = new EglTemplateFactory();
		EglTemplate template = null;
		try {
			File f = FileUtil.getFile("absolute.egl", Runner.class);
			template = tf.load(f);
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			String output = template.process();
			System.out.println(output);
		} catch (EolRuntimeException r) {
			r.printStackTrace();
		}
	}

Contents of EGL template:

[%
var t : Template := TemplateFactory.load('file:///Users/louis/Code/eclipse/workspaces/helios/epsilon-user/egl.problem/src/problem/simple.egl');
%]

[%=t.process()%]
Comment 1 Louis Rose CLA 2010-11-11 07:31:08 EST
This is a bug, caused by EglComplexType mandating that Template variables are of type EglFileGeneratingTemplate. I've changed EglComplexType to type-check Template variables against EglTemplate instead.
Comment 2 Louis Rose CLA 2010-11-12 05:13:53 EST
I've checked a fix into SVN. Assigning to Dimitris for build integration - thanks!
Comment 3 Dimitris Kolovos CLA 2010-11-25 08:10:03 EST
Fixed in 0.9.0.