Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 795
Tom Tresansky Avatar asked Oct 04 '22 23:10

Tom Tresansky


1 Answers

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.

like image 161
Roel Spilker Avatar answered Oct 13 '22 12:10

Roel Spilker