2

I wonder if anyone is using codenameone with lombok in Eclipse. I've googled, but all I could find is an old question of mine.

A tiny success

I've tried it, took a demo project, modified nothing and opened it in my Eclipse configured for Lombok. When compiling, I got the same stacktrace as here. I've added /usr/lib/jvm/java-8-oracle/lib/tools.jar to the path under Preferences -> Installed JREs -> Edit -> JRE system libraries (which may be a pure non-sense) and it didn't help.

Then I've replaced compiler="modern" by compiler="extJavac" in build.xml and it compiles. I can even use Lombok annotations and they compile and work in the simulator.

The problem

I'm afraid, this was the simple part. I guess, for submitting, I need to replace the source code by the output of delombok. I've tried to submit it as is and nothing happened (no error, no response).

  • Has anyone done it already?
  • Any tips?
maaartinus
  • 44,714
  • 32
  • 161
  • 320

2 Answers2

2

You shouldn't change the classpath but if the bytecode has access to the properties then it should "just work". If you look at the build.xml file you will notice that it has targets for every one of the supported platforms and before the target occurs you will see a compilation target that packages the JAR that's sent to the servers.

Steve wrote a post about porting other languages to Codename One. This is simple by comparison.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
2

It actually works! All I had to do was to

  • add the path to lombok.jar to the Java Build Path1
  • in the javac call of the jar task
    • replace compiler="modern" by compiler="extJavac"
    • add the path to lombok.jar to the classpath

1 This is not recommended as the dependency is unavailable on the build server, but that's exactly right. Lombok is a compile-time only dependency and the build seems to be based on the dist.jar, where Lombok has already done its job.


One year later: There was a problem with my old setup, so I installed everything anew and it seems to work. Just note that there are three javac tasks in the build.xml.

maaartinus
  • 44,714
  • 32
  • 161
  • 320