java - Warning equals/hashCode on @Data annotation lombok with inheritance -
i have entity inherits other. on other hand, i'm using lombok project reduce boilerplate code, put @data annotation. annotation @data inheritance produces next warning:
generating equals/hashcode implementation without call superclass, though class not extend java.lang.object. if intentional, add '@equalsandhashcode(callsuper=false)' type.
is advisable add annotation @equalsandhashcode (callsuper = true) or @equalsandhashcode (callsuper = false)? if not added, 1 callsuper=false or callsuper=true?
the default value false. 1 if don't specify , ignore warning.
yes, recommended add @equalsandhashcode annotation on @data annotated classes extend else object. cannot tell if need true or false, depends on class hierarchy, , need examined on case-by-case basis.
however, project or package, can configure in lombok.config call super methods if not direct subclass of object.
lombok.equalsandhashcode.callsuper = call for configuration system documentation on how works, , @equalsendhashcode documentation supported configuration keys.
disclosure: lombok developer.
Comments
Post a Comment