忽略Lombok构建警告

警告: 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.

  • 原因:@Data 自动生成的 equals 和 hashCode 方法未调用父类的实现
  • 配置方法:lombok.equalsAndHashCode.callSuper=call
  • 解决原理:设置@Data生成的 equals 和 hashCode 方法包含对父类字段的处理

警告: @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final.

  • 原因:@Builder 不会给字段进行默认值赋值
  • 配置方法:没有配置项,只能在需要的字段上加上 @Builder.Default
  • 解决:设置 build 方法赋值字段默认值

lombok.config可以放在项目文件夹外面,比如D盘根目录,这样编译也是生效的

相关推荐
Flittly16 小时前
【AgentScope Java新手村系列】(16)从RAG到多路检索
java·spring boot·spring
小兔崽子去哪了16 小时前
Java 生成二维码解决方案
java·后端
人活一口气21 小时前
从JVM调优到MCP协议:Java全栈技术体系深度总结与企业级架构实践
java·spring boot
NE_STOP1 天前
Vibe Coding -- 完整项目案例实操
java
荣码1 天前
GraphRAG:普通RAG只能回答"点"的问题,我踩了4个坑才搞懂
java·python
SimonKing1 天前
Google第三方授权登录
java·后端·程序员
明月光8181 天前
从一行 @Builder 说起:重新拾起 Java 的 Lombok、注解与 Builder 模式
java
考虑考虑1 天前
Mybatis实现批量插入
java·后端·mybatis
咖啡八杯1 天前
GoF设计模式——中介者模式
java·后端·spring·设计模式
青石路2 天前
记一次多JDK版本问题的排查,一坑套一坑,差点没爬上来
java