Tom Tresansky
Tom Tresansky

Reputation: 19892

Custom Lombok Extensions Require Lombok Package?

I've been experimenting with adding custom annotations to Lombok. My starting point is a fork of the source on GitHub.

I added an annotation that works fine. I can use the included eclipse launch (or build a jar and swap it into my eclipse.ini) to test and see results: I've successfully inserted a method into a class.

Now, this only works if I put my additional handler classes under the lombok package. If I put them under another package, they simply won't work. I can create a new physical source directory, tweak the build script to include it appropriately, and have my new classes live there, so long as it logically packages new classes under lombok.

Why is this? Is there anyway around it? I would like to separate out any additions I write into a new top-level package to keep them distinct from the official lombok extentions.

Upvotes: 5

Views: 875

Answers (1)

Roel Spilker
Roel Spilker

Reputation: 34452

Due to classloader issues in Eclipse, Lombok patches the Equinox classloader to load classes in the lombok package from a different location. This is hardcoded. So your extension must also be in the lombok package, or you need to modify the code in EclipsePatcher to also include your own package.

Full disclosure: I am one of the Project Lombok developers.

Upvotes: 4

Related Questions