Reputation: 24411
I'm trying to lombok for the first time. I tried to follow directions as best as possible, but when I look at my compiled classes (using a decompiler) they do not have any of the generated getters or setters.
My installation steps:
Downloaded lombok 1.14.8 and ran java -jar lombok.jar. It added lombok to eclipse. Restarted Eclipse (-clean the workspace too). If I check my About Eclipse page, I see:
"Lombok v1.14.8 "Branching Cobra" is installed. http://projectlombok.org/"
Added lombok to my pom.xml:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
<version>1.14.8</version>
</dependency>
Maven->Update Project. Project->Clean
My Lombok'ed java class:
import lombok.Getter;
import lombok.Setter;
public class User extends BaseCouchDbDocument {
public User() {
// TODO Auto-generated constructor stub
}
@Getter @Setter
private String name;
}
When using the code completion in Eclipse, I see User.getName()
and User.setName()
appear. However, if I try to use the getters or setters, I get a compile time error that no such method exists. When I look at the generated .class file, I only see the following:
public class User extends BaseCouchDbDocument
{
private String name;
}
Similarly, if I run mvn compile
from the command line, I get the same class output.
What I find odd is that the @Getter
and @Setter
annotations are removed, implying that there is some processing occurring on my files. But the getters/setters aren't being generated.
Am I doing something wrong? I'm using Java 7 on a Mac.
Upvotes: 4
Views: 4210
Reputation: 24411
After posting this, I ran across a bug report that indicated it was a problem with AspectJ.
Indeed, I am using AspectJ with my project, and it is causing conflicts with Lombok. Removing AspectJ now shows properly generated setters/getters.
This obviously does not "resolve" the issue, but at least points me in the right direction. I created another issue here to track this specific problem.
Hopefully this can help someone else in the future as well.
Upvotes: 4