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

Bug 316495

Summary: Globalvar string values will be evaluated to properties
Product: [Modeling] M2T Reporter: Michael Ernst <chiptv>
Component: XpandAssignee: Project Inbox <m2t.xpand-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Michael Ernst CLA 2010-06-10 12:51:15 EDT
Build Identifier: M20090917-0800

A globalvar definition within the org.eclipse.xpand2.Generator component configuration results to an error if the value is of type String.

<globalVarDef name="test4" value="foobar"/> <-- result in error:
Error in Component  of type org.eclipse.xpand2.Generator: 
	EvaluationException : Couldn't find type or property 'foobar'
	nofile[0,6] on line 1 'foobar'

<globalVarDef name="test4" value="${foobar}"/> <-- result in error:
Error in Component  of type org.eclipse.xpand2.Generator: 
	EvaluationException : Couldn't find type or property 'foo'
	nofile[0,6] on line 1 'foo'

<globalVarDef name="test4" value="2"/> <-- works

Reproducible: Always
Comment 1 Karsten Thoms CLA 2013-10-22 17:51:59 EDT
Works as expected.

The value of a global var definition is expected to be an expression. It will be evaluated in org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent#getGlobalVars(). If a simple string is used as global var value, it will be evaluated as an identifier. To actually pass a string, you need to surround the value with quotes:

<globalVarDef name="test4" value="'foobar'"/>
Comment 2 Eclipse Webmaster CLA 2017-10-31 11:24:31 EDT
Requested via bug 522520.

-M.