Plugin: adding formatted array of annotations with AddAnnotationFix

Answered

I'm using a AddAnnotationFix to add custom annotations. One of which is an annotation containing an array of other annotations.

When I create the string to pass to AddAnnotationFix, I concatenate all the "@Used(clazz = b.class), " by ",\n" hoping to see them going to new lines like in the example. 

I don't understand if it is a style configuration problem (which properties are making everything in line!?) or I'm doing something wrong when creating the annotation.

Result:  

@UsedList({@Used(clazz = a.class), @Used(clazz = b.class), @Used(clazz = c.class), @Used(clazz = d.class)})

Expected:

@UsedList({
@Used(clazz = a.class),
@Used(clazz = b.class),
@Used(clazz = c.class),
@Used(clazz = d.class)
})
0
1 comment

Hi,

You don't need to create line breaks manually as the code should be reformatted according to current code style scheme used, should be adjusted by the code style property File | Settings | Editor | Code Style | Java | Wrapping and Braces | Annotation parameters. 

Anna

 

0

Please sign in to leave a comment.