Lombok - warning with @Data when equals and hashcode are implemented

Viewed 11982

I have JPA entity that extends other abstract class. I want to use @Data to avoid writing setters and getters but my equals and hashcode methods exists.

I get warning but I think I should not:

server\entity\User.java:20: warning: 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
^

In my User class:

@Data
@Entity
public class User extends AbstractAuditingEntity implements Serializable {

    ....

    @Override
    public boolean equals(Object o) {
       ...
    }

    @Override
    public int hashCode() {
       ...
    }
}

When I add additionally @EqualsAndHashCode(callSuper = false) to @Data I get:

server\entity\User.java:21: warning: Not generating equals and hashCode: A method with one of those names already exists. (Either both or none of these methods will be generated).
@EqualsAndHashCode(callSuper = false)
1 Answers
Related