I have 2 classes in a Eclipse project.
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());
}
}
After building, Eclips reports "the value of the field value is not used"
for MyBean
class and "The method value() is undefined for the type MyClass"
even though Eclipse's content assist shows MyBean#value()
method, there are no warnings before building, and compilation, execution both are finished successfully.
So I guess Lombok works properly and the problem is Eclipse doesn't recognize Lombok.
Here are what I tried and found.
- attaching lombok.jar to Eclipse and checking eclipse.ini
- cleaning and rebuild the project
- removing Lombok dependency from maven local repository then reinstall
- the problems only occur in this project. Eclipse handles other projects with lombok properly (and all projects belong in the same workspace).
- I cannot reproduce these problems in other projects.
Any ideas?
CodePudding user response:
Finally, the problems are solved by just creating new project and moving all sources and resources to it. It seems that Eclipse's project configurations were broken I don't know why.