Community
Participate
Working Groups
Build ID: M20071023-1652 Steps To Reproduce: 1.Create some code that has annotations with long parameter lists. This is very likely when using Hibernate. Please see the following example class: import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Parameter; /** * An example class that uses Hibernate Annotations that have long annotation parameters, which will not be wrapped by * the Eclipse Code-Formatter */ @Table(uniqueConstraints = @UniqueConstraint(columnNames = { "_id", "_column" })) @Entity public class ExampleEntity { @Id @GeneratedValue(generator = "ExampleSequence") // The following line shows the wrapping problem @GenericGenerator(name = "ExampleSequence", strategy = "org.hibernate.id.SequenceGenerator", parameters = { @Parameter(name = "sequence", value = "example_seq"), @Parameter(name = "parameters", value = "minvalue 1 maxvalue 9999999999 start with 1 increment by 1 cache 20") }) // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /* The Code Formatter should allow parameters per line like this: * * @GenericGenerator(name = "ExampleSequence", * strategy = "org.hibernate.id.SequenceGenerator", * parameters = { @Parameter(name = "sequence", value = "example_seq"), * @Parameter(name = "parameters", * value = "minvalue 1 maxvalue 9999999999 start with 1 increment by 1 cache 20") }) * */ private Long _id; @Column(name = "asset_equals_id", nullable = false) private String _column; } 2. Try to format it using the Java code-formatter. The formatter will not wrap the parameters in Line 23. There also is no option in code formatting rules for wrapping annotation parameters like it is for methods and other elements. (For this class to compile you would need persistence-api-1.0.jar and hibernate-annotations-3.2.1.ga.jar in your classpath. Code Formatter should work without them) More information:
see also bug 207330
Just to prevent misunderstandings, as far as I understand bug 207330 is about annotations on method parameters like: method(@annotation parameter) This bug is about parameters of annotations like: @annotation(parameter, parameter) I don't know about similarities in the eclipse implementation but from a user perspective this looks different.
I missed this duplicate while fixing bug 282030... *** This bug has been marked as a duplicate of bug 282030 ***
Verified for 3.7 M1 using build I20100802-1800