Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316495 - Globalvar string values will be evaluated to properties
Summary: Globalvar string values will be evaluated to properties
Status: CLOSED WORKSFORME
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 12:51 EDT by Michael Ernst CLA
Modified: 2017-10-31 11:24 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.