Community
Participate
Working Groups
= Problem description = Currently, Xtend/Xpand/CheckJob don't make any assumptions about the encoding of the Xtend/Xpand/Check files they have to process. They just create and let the respective execution contexts use an instance of org.eclipse.xtend.expression.ResourceManagerDefaultImpl which in turn attempts to detect the encoding of Xtend/Xpand/Check files using org.eclipse.internal.xtend.util.internal.icu.CharsetDetector.CharsetDetector() and other things. The problem is, that this doesn't work out well for Eclipse workspace files all the time. It occasionally causes Xtend/Xpand/Check files to be loaded with inappropriate encoding information and exceptions like this org.eclipse.internal.xtend.xtend.parser.ParseException: no viable alternative at input 'Â' on line 15 at org.eclipse.internal.xpand2.parser.XpandParseFacade$3.handleError(XpandParseFacade.java:77) at org.eclipse.internal.xpand2.parser.XpandParseFacade$2.reportError(XpandParseFacade.java:66) at org.eclipse.internal.xpand2.parser.XpandParser.template(XpandParser.java:371) at org.eclipse.internal.xpand2.parser.XpandLocationAddingParser.template(XpandLocationAddingParser.java:289) at org.eclipse.internal.xpand2.parser.XpandParseFacade.file(XpandParseFacade.java:44) at org.eclipse.internal.xpand2.parser.XpandParseFacade.file(XpandParseFacade.java:31) at org.eclipse.xpand2.XpandExecutionContextImpl$1.parse(XpandExecutionContextImpl.java:174) at org.eclipse.xtend.expression.ResourceManagerDefaultImpl.loadResource(ResourceManagerDefaultImpl.java:70) at org.eclipse.xpand2.XpandExecutionContextImpl.findTemplate(XpandExecutionContextImpl.java:277) at org.eclipse.xpand2.XpandExecutionContextImpl.findTemplate(XpandExecutionContextImpl.java:270) at org.eclipse.xpand2.XpandExecutionContextImpl.findDefinition(XpandExecutionContextImpl.java:227) at org.eclipse.xpand2.XpandFacade.evaluate2(XpandFacade.java:57) at org.eclipse.xpand2.XpandFacade.evaluate(XpandFacade.java:43) at org.eclipse.sphinx.xtendxpand.jobs.XpandJob$1.run(XpandJob.java:352) at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328) at org.eclipse.sphinx.xtendxpand.jobs.XpandJob.runInWorkspace(XpandJob.java:358) at org.eclipse.sphinx.xtendxpand.jobs.M2TJob.runInWorkspace(M2TJob.java:64) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) to be raised subsequently. = Proposed resolution = Improve implementation of Xtend/Xpand/CheckJob#runInWorkspace() methods so follows: For each Xtend/Xpand/Check file under evaluation * call IFile#getCharset() to retrieve concise encoding information * call ResourceManager#setFileEncoding() on ResourceManager instance used by the respective execution context so as to make sure that Xtend/Xpand/Check files get loaded with correct encoding information.
Fixed as proposed in description.
Mass-closing Resolved tickets