Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Lombok with GWT in Development Mode?

Tags:

java

lombok

gwt

I tried to follow the official instructions on running a lomboked GWT project in dev mode, but either I'm doing something wrong, or this doesn't work with current versions of GWT anymore?

The error I get is:

"The method setA(int) is undefined for the type MyData".

MyData is simple:

@Data
public class MyData {
  private int a;
}

I'm specifying

-javaagent:/path/to/lombok.jar=ECJ

in my Eclipse Run Configuration (as a VM argument).

I also tried playing around with

-Xbootclasspath/p:/path/to/lombok.jar

, as well as starting dev mode from my ant file, etc.

The problem is, that I'm mostly just guessing how the whole setup should work, so instead of troubleshooting my poor attempts, I'd like to ask how a correct setup would look like?

like image 230
Chris Lercher Avatar asked Dec 07 '11 11:12

Chris Lercher


2 Answers

You've probably got it working by now, but I can confirm it does work with GWT2.4 / Eclipse 3.7 . The only option needed is the -javaagent VM arg, and adding lombok.jar to the classpath/buildpath.

I think there's some issues when you first start to use it, to do with either the gwt-unitCache folder, and the war/WEB-INF/classes folder, clearing these is probably a good step when setting it up !

like image 163
aidanok Avatar answered Nov 17 '22 00:11

aidanok


I think you've stumbled upon Issue 393. If that's the case you can try the latest edge release

Disclosure: I'm one of the project lombok developers.

like image 36
Roel Spilker Avatar answered Nov 17 '22 02:11

Roel Spilker