[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-core-dev] Strange formatting when using JDT core DOM infrastructure
|
Hi folks!
I'm working on the JBoss Forge tool (
https://docs.jboss.org/author/display/FORGE/Home). For some of its features it uses JDT core tooling to generate or modify Java classes. For example, it may create JPA entities. However, the final format is quite weird:
package com.example.test;
import javax.persistence.Entity;public @Entity class Employee {}
I would expect something like that:
package com.example.test;
import javax.persistence.Entity;
@Entity
public class Employee {}
You noticed how in the generated input the import, the annotation and the class declaration are on a single line? And @Entity is placed between the public and class words?
I have attached here a sample class, which demonstrates how we use the JDT parser API. Could you please tell me what I am doing wrong? And is it possible to have more beautiful formatting?
Thanks and regards,
Ivan
Attachment:
JdtFormatterTest.java
Description: Binary data