]
George Gastaldi reopened ROASTER-112:
-------------------------------------
Roaster.format(Properties, String) doesn't respect formatting
properties
------------------------------------------------------------------------
Key: ROASTER-112
URL:
https://issues.jboss.org/browse/ROASTER-112
Project: Roaster
Issue Type: Feature Request
Affects Versions: 2.19.0.Final
Environment: pom.xml:
<roaster.version>2.19.0.Final</roaster.version>
<dependency>
<groupId>org.jboss.forge.roaster</groupId>
<artifactId>roaster-api</artifactId>
<version>${roaster.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.forge.roaster</groupId>
<artifactId>roaster-jdt</artifactId>
<version>${roaster.version}</version>
</dependency>
Reporter: Jakub Niedermertl
Assignee: George Gastaldi
Fix For: 2.19.2.Final
Roaster.format(Properties, String) is not compatible with constants from
org.jboss.forge.roaster._shade.org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants.
The problem is that org.jboss.forge.roaster.Roaster#getFormatters returns list of one
element - instance of org.jboss.forge.roaster.spi.FormatterProviderImpl and
org.jboss.forge.roaster.spi.FormatterProviderImpl#format(java.util.Properties,
java.lang.String) calls Formatter.applyShadedPackageName(properties) that adds another
shading prefix to constants that already have it.
E.g.
org.jboss.forge.roaster._shade.org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_TAB_CHAR
is resolved as
"org.jboss.forge.roaster._shade.org.eclipse.jdt.core.formatter.tabulation.char"
and Formatter.applyShadedPackageName call results in
"org.jboss.forge.roaster._shade.org.jboss.forge.roaster._shade.org.eclipse.jdt.core.formatter.tabulation.char".
Adding dependency on artifact containing original
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants or using raw strings can be a
workaround.