lombok註解@Data使用在繼承類上時出現警告Generating equals/hashCode implementation but without a call to superclass, even though this class ...
阿新 • • 發佈:2020-12-02
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)在子類上面直接加
@EqualsAndHashCode(callSuper = true)
這個方法在每個子類上都要加入。
2)在實體類的目錄里加入一個config
lombok.config內容如下:
config.stopBubbling=true lombok.equalsAndHashCode.callSuper=call
以配製檔案的形式,可以不用在子類上加入,全域性有效。
pom.xml還要加入下面的
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin>
從單詞的意思來看就是指定編譯jdk的版本,以及編譯了。
參考: