Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334934 - The error "no alternative at 'Â'" arises by using a working template with the correct encoding
Summary: The error "no alternative at 'Â'" arises by using a working template with the...
Status: CLOSED WORKSFORME
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-20 13:29 EST by tobias Mising name CLA
Modified: 2017-10-31 11:24 EDT (History)
1 user (show)

See Also:


Attachments
a zipped workspace containing one minimal example project with the error (506.05 KB, application/octet-stream)
2011-01-20 13:33 EST, tobias Mising name CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description tobias Mising name CLA 2011-01-20 13:29:21 EST
Build Identifier: 20100617-1415

Templates that worked under XPand 0.7.x doesn't work under 1.0.1. The problem was discussed on the mailing list (http://www.eclipse.org/forums/index.php?t=msg&th=201339&start=0&S=799a81ddc445ba30d85b940956ec7659) and assumed as a bug.

It is a strange error, to drill it down, here the minimal samle. If a have a template like this, everything works fine: 

«REM»
    Performs the generation of javadoc comments
    
    works not deterministic
«ENDREM»
«IMPORT gcore»

«DEFINE Root FOR MModel -»
«ENDDEFINE»

If I change just the words in the third line of the comment, so the template appears as follows, it doesn't work anymore:

«REM»
    Performs the generation of javadoc comments
    
    i dont understand it
«ENDREM»
«IMPORT gcore»

«DEFINE Root FOR MModel -»
«ENDDEFINE»


However, I found a general workaround to move the import statement before the comment, so the template is again working correctly:

«IMPORT gcore»
«REM»
    Performs the generation of javadoc comments
    
    i dont understand it
«ENDREM»

«DEFINE Root FOR MModel -»
«ENDDEFINE»

I can even write this and it works fine:
«REM»
    Performs the generation of javadoc comments
    
    works not determini'stic
«ENDREM»

«IMPORT gcore»

«DEFINE Root FOR MModel -»
«ENDDEFINE»


I can successfully parse all the templates which results on errors during execution using the XpandParseFacade. Please find a minimal project in the attached workspace.

Reproducible: Always

Steps to Reproduce:
You will find 5 launch configurations there, 4 to execute workflows showing the problem and one for a junit test:
1. start the mwe workflow file 'workflowError' to get the error
2. start the mwe workflow file 'workflowWorking' to start the working template
3. start the mwe workflow file 'workflowWorkingToo' to start the other working template
4. start the mwe workflow file 'workflowErrorWorking' to start the template with the workaround
5. start the junit test to verify that the erroneous tempalte can be parsed successfully
Comment 1 tobias Mising name CLA 2011-01-20 13:33:05 EST
Created attachment 187222 [details]
a zipped workspace containing one minimal example project with the error

You will find 5 launch configurations there, 4 to execute workflows showing the
problem and one for a junit test:
1. start the mwe workflow file 'workflowError' to get the error
2. start the mwe workflow file 'workflowWorking' to start the working template
3. start the mwe workflow file 'workflowWorkingToo' to start the other working
template
4. start the mwe workflow file 'workflowErrorWorking' to start the template
with the workaround
5. start the junit test to verify that the erroneous tempalte can be parsed
successfully
Comment 2 Karsten Thoms CLA 2012-11-29 16:10:47 EST
The input file encoding must be set to make it deterministic, see "Encoding" chapter in Xpand manual.

<component class="org.eclipse.xpand2.Generator">
 ...
 <resourceManager class ="org.eclipse.xtend.expression.ResourceManagerDefaultImpl">
  <fileEncoding value="UTF-8"/>
 </resourceManager>
Comment 3 Eclipse Webmaster CLA 2017-10-31 11:24:53 EDT
Requested via bug 522520.

-M.