[forge-issues] [JBoss JIRA] (ROASTER-75) Encoding of source[?] code cannot be easily configured.
George Gastaldi (JIRA)
issues at jboss.org
Fri Sep 25 17:18:00 EDT 2015
[ https://issues.jboss.org/browse/ROASTER-75?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
George Gastaldi updated ROASTER-75:
-----------------------------------
Fix Version/s: 2.16.1.Final
(was: 2.x Future)
> Encoding of source[?] code cannot be easily configured.
> -------------------------------------------------------
>
> Key: ROASTER-75
> URL: https://issues.jboss.org/browse/ROASTER-75
> Project: Roaster
> Issue Type: Enhancement
> Components: API, JDT
> Affects Versions: 2.14.0.Final, 2.15.0.Final
> Environment: Java 8 64bit, Eclipse Mars, Windows 8.1 Pro 64bit
> Reporter: Shoji Kuzukami
> Priority: Minor
> Fix For: 2.16.1.Final
>
>
> The parser encoding for souce code can only be configured by the 'file.encoding' system parameter, as we can see in JavaParserImpl, "String encoding = System.getProperty("file.encoding", "ISO8859_1");".
> Even though the Roaster API can receive a 'String' source as "public static JavaType<?> parse(final String data)" in the 'Roaster.java', the 'String' of source can only contain "ISO8859_1" charsets if we don't change the "file.encoding".
> The parser SPI in 'JavaParser.java' is defined as "JavaUnit parseUnit(final InputStream data);" instead of "JavaUnit parseUnit(Reader source);". I think it is adequate considering that the Roaster API will accept some binary sources (such as bytecode) in near future.
> I recommend that the SPI "JavaUnit parseUnit(final InputStream data);" is expanded into "JavaUnit parseUnit(final InputStream data, Charset encodingIfText );" and some encoding refactors are done in the 'Roaster.java' without any change of semantics in the Roaster APIs except for the 'String' souce APIs as "public static JavaType<?> parse(final String data)".
> The 'Charset' argument is used only if the 'data' of InputStream must be interpreted as 'String' ( as a case of source code ).
> If this idea is accepted by this project design, I'll refactor the code and do a pull-requeust.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the forge-issues
mailing list