Mongoosej.Blog.Software.Programing Language.Java.Framework.Utils.Jars.lombok
:::info
版权声明:本文为语雀博主「mongoosej」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://www.yuque.com/mongoosej/blog/lombok
:::
Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.
FAQ
导入已经使用了Lombok的项目
Eclipse如果以前没有使用过Lombok,但是导入了使用了Lombok的项目后,然后安装Lombok,可能Entity类不会报错了,但是调用了Entity的getter/setter方法的类可能还会提示Entity的方法未定义,此时,需要Eclipse —> Project —> Clean,Eclipse会重新编译项目,解决编译报错。
Generating equals/hashCode implementation but without a call to superclass
子类添加@Data注解时,出现编译警告:
Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add ‘@EqualsAndHashCode(callSuper=false)’ to your type.
通过添加@EqualsAndHashCode(callSuper=true)可以解决问题。
reference1
reference2