Sjaak
Sjaak

Reputation: 4140

Eclipse formatter: how do I format arrays in annotations

I'm using Hibernate Validation (JSR 303) and I'm trying to tame the Eclipse formatter to have nested annotations on seperate lines. Example:

    @DefinedParametersMatchesResultPresence.List( {
    @DefinedParametersMatchesResultPresence( measurement = Measurement.penetrationLength ),
    @DefinedParametersMatchesResultPresence( measurement = Measurement.coneResistance ), @DefinedParametersMatchesResultPresence( measurement = Measurement.depth ),
    @DefinedParametersMatchesResultPresence( measurement = Measurement.electricalConductivity ),

} )

However.. I can't get the annotations in the DefinedParametersMatchesResultPresence.List on a new line when running format. Additionally, the formatter does not comply to my max line length and wrap to a new line.

I'm using:

Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600

Upvotes: 2

Views: 724

Answers (1)

Sjaak
Sjaak

Reputation: 4140

Although the formatting concerns annotations, the array formatting also applies. After setting array formatting correctly it works as expected.

Next: its also possible to use the @Repeatable annotation when using your own annotations which lead to a nicer

Upvotes: 1

Related Questions