如何防止 Eclipse 格式化程序在注释中的注释后添加空格?

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

当我格式化这段代码时:

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

eclipse在注解中每个注解的右括号后添加一个空格,像这样:

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

如何预防? (删除格式化程序配置中的所有空格不会改变任何东西...)

1) 转到 Window -> 首选项 -> Java -> 代码样式 -> 格式化程序

2) 点击"Edit"

3) 打开选项卡空白

4) 展开"Declarations"

5) 单击注释

6) 您可以在下面找到白色间距的选项。

7) 去掉厚的 "before closing paranthesis"

我附上了照片。

我终于找到了一个解决方法,我在内部注释前后添加大括号:

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