[英]Eclipse reporting "the value of the field is not used" warning even though Lombok enable
我在 Eclipse 項目中有 2 個課程。
package com.example;
import lombok.Getter;
import lombok.experimental.Accessors;
@Accessors(fluent = true)
@Getter
public class MyBean {
private String value = "aaa";
}
package com.example;
public class MyClass {
public static void main() {
System.out.println(new MyBean().value());
}
}
構建后,Eclips 報告MyBean
class "the value of the field value is not used"
和"The method value() is undefined for the type MyClass"
即使 Eclipse 的內容輔助顯示MyBean#value()
方法,也沒有警告在構建和編譯之前,執行都已成功完成。 所以我猜 Lombok 工作正常,問題是 Eclipse 無法識別 Lombok。
這是我嘗試和發現的。
有任何想法嗎?
最后,只需創建新項目並將所有資源和資源移至該項目即可解決問題。 似乎Eclipse的項目配置被破壞了我不知道為什么。
我在 eclipse(java -jar lombokxxxx.jar) 上安裝了 lombok 並且問題消失了。
龍目島 API 配置
注意:龍目島版本可能會更改。 目前我們正在使用 1.18.24
Lombok configuration window
將打開 > 單擊Specify location
按鈕Lombok configuration window
中的Install / Update
按鈕
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.