sunny123456

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

Idea使用lombok时warn:Generating equals/hashCode implementation but without a call
子类实体的equals/hasCode方法无法继承父类属性

错误

在这里插入图片描述

Warning:(15, 1) java: 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.
  • 1

原因

子类实体的equals/hasCode方法无法继承父类属性

解决方法一

@EqualsAndHashCode(callSuper = true)
  • 1

在这里插入图片描述

解决方法二

lombok.config配置文件
内容

config.stopBubbling=true
lombok.equalsAndHashCode.callSuper=call
  • 1
  • 2

在这里插入图片描述

https://blog.csdn.net/sndayYU/article/details/100891751
posted on 2022-04-11 22:25  sunny123456  阅读(837)  评论(0编辑  收藏  举报