@AllArgsConstructor(suppressConstructorProperties = true)
在 eclipse 中显示以下错误:
This deprecated feature is no longer supported. Remove it; you can create a lombok.config file with 'lombok.anyConstructor.suppressConstructorProperties = true'.
我创建了这个文件,但在注释@AllArgsConstructor 行后错误并没有消失。
有人可以帮忙确定这个文件的确切位置 - 我尝试保留在项目根目录和 src 文件夹中,但即使在 eclipse 中清理项目后它也不起作用?我们是否需要为 lombok.config 中的更改执行任何特定操作以反射(reflect),就像我们必须在安装 lombok 后重新启动 eclipse 一样。
我正在使用 lombok 版本
1.16.18
, 试过 1.14.4
版本也一样,但同样的问题。
最佳答案
根据 lombok您可以创建 lombok.config
任何目录中的文件并将配置指令放入其中。这些适用于此目录和所有子目录中的所有源文件。
因此,如果您想影响所有代码,请输入 lombok.config
在您的根目录中。
在您的 lombok.config
文件指定
lombok.anyConstructor.suppressConstructorProperties=true
If true, lombok will not generate a
@java.beans.ConstructorProperties
annotation when generating constructors. This is particularly useful for GWT and Android development.
在你的类里面只需使用
@AllArgsConstructor
以这种方式 :@AllArgsConstructor
public class Simple {
private String text;
private int num;
}
关于java - java 项目中 lombok.config 文件的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48111020/