javaeclipsecode-formattingeclipse-formatter

How to prevent Eclipse formatter from adding a whitespace after annotations in annotations?


When I format this code:

@JoinTable(name = "UTI_COLLECTER_CTN",
  joinColumns = @JoinColumn(name = "COD_UTI", referencedColumnName = "COD_UTI"),
  inverseJoinColumns = @JoinColumn(name = "COD_CTN", referencedColumnName = "COD_CTN"))

eclipse adds a whitespace after each closing parenthesis of annotation in annotation, like this:

@JoinTable(name = "UTI_COLLECTER_CTN",
  joinColumns = @JoinColumn(name = "COD_UTI", referencedColumnName = "COD_UTI") ,
  inverseJoinColumns = @JoinColumn(name = "COD_CTN", referencedColumnName = "COD_CTN") )

How to prevent it? (Removing all whitespaces in the formatter config does not change anything...)


Solution

  • I finally found a workaround, I add braces before and after the inner annotations:

    @JoinTable(name = "UTI_COLLECTER_CTN",
      joinColumns = {@JoinColumn(name = "COD_UTI", referencedColumnName = "COD_UTI")},
      inverseJoinColumns = {@JoinColumn(name = "COD_CTN", referencedColumnName = "COD_CTN")})