How does lombok work?

Lombok does indeed code against internal API, as Sean Patrick Floyd said. However, as lombok is ONLY involved in the compilation phase, its misleading to claim Lombok will only run on a sun VM. It’ll only compile on ecj or sun’s javac. However, the vast majority of VMs out there, if they ship a compiler at all, are one of those two. For example, the Apple VM ships with stock sun javac, and as such lombok works just fine on macs. Same goes for the soylatte VM, for example.

While for javac we really do have to stick with their updates, partly because of a lot of ongoing work on their compiler right now, we’ve had to make just 1 minor adjustment to our eclipse support over many many versions of eclipse. So, while we do code against internal API, they are relatively stable bits.

If what lombok does could be done without resorting to internal API, we’d have done something else, but it can’t be done, so we resort to internal API usage.

NB: I’m one of the lead developers of lombok, so, I’m probably a little biased 😛

Leave a Comment