[
https://issues.jboss.org/browse/ROASTER-126?page=com.atlassian.jira.plugi...
]
George Gastaldi commented on ROASTER-126:
-----------------------------------------
I am not really sure what I should be looking at. I created the following test and the
options are taken into account appropriately. If I increase the TAB_SIZE, the code shifts
to the right correctly, for example:
{code:java}
public static void main(String[] args) throws Exception
{
String body = "CsvDataFormat dataformat = new CsvDataFormat();";
JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
javaClass.setPackage("com.github.lburgazzoli.forge");
javaClass.setName("MyGeneratedClass");
javaClass.addImport(Map.class);
javaClass.addMethod().setPublic().setName("createDataFormat").setBody(body);
Properties properties = new Properties();
properties.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT,
"120");
properties.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR,
"space");
properties.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
properties.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION,
"next_line");
properties.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION,
"next_line");
System.out.println(Formatter.format(properties, javaClass));
}
{code}
Format options not taken into account
-------------------------------------
Key: ROASTER-126
URL:
https://issues.jboss.org/browse/ROASTER-126
Project: Roaster
Issue Type: Bug
Components: Formatter
Affects Versions: 2.20.0.Final
Reporter: Luca Burgazzoli
Priority: Minor
I'm doing some small experiments with Forge Roaster and I'm unable to get some
formatting options taken into account.
My code and the result is here:
https://gist.github.com/lburgazzoli/115377c3887972696f77db3a71fef85f
As you can notice, I configured some properties so that the code should wrap at column
120 and it should use spaces instead of tabs but my set-up is ignored and the resulting
code is still formatted with some defaults.
I set the formatting properties with:
{code:java}
properties.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "120")
properties.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, "space")
properties.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4")
{code}
The behaviour does not change if I use constants without the shaded package value.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)