|[Solved]: Source code formatter: inline comments not being formatted [message #1815829]
||Fri, 11 October 2019 15:20
| Chkiron Chronos
Registered: October 2019
I am writing a custom application to format Java source files in the same way that Eclipse's formatter does.
The only failing test I have at the moment is checking if my application can format JDK 8's java.util.HashMap source code in the same way that Eclipse does.
I have only 8 differences, all of them caused by this type of comment:
(on the left is the hashmap as formatted by Eclipse, on the right is my version)
I have created a CodeFormatter using both ToolFactory.M_FORMAT_EXISTING and ToolFactory.M_FORMAT_NEW, with no difference in the results:
// Using ToolFactory.M_FORMAT_NEW
// CodeFormatter codeFormatter =
// Using ToolFactory.M_FORMAT_EXISTING
CodeFormatter codeFormatter =
TextEdit textEdit = codeFormatter.format(
CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS,
IDocument doc = new Document(sourceCodeToFormat);
I am using the same XML file to configure the formatter both of my Eclipse and my custom application, and have checked that they are identical in runtime.
What my formatter is missing, would you know?
Thanks in advance and kind regards!
[Updated on: Mon, 14 October 2019 05:07]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.03019 seconds