Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lombok Processing #289

Closed
kevinmic opened this issue Feb 22, 2017 · 6 comments
Closed

Lombok Processing #289

kevinmic opened this issue Feb 22, 2017 · 6 comments

Comments

@kevinmic
Copy link

kevinmic commented Feb 22, 2017

I am looking to upgrade the the latest Achilles and noticed that you added an annotation processor. I heavily use Lombok to generate getters/setters for my entities and would like to continue to do so. I am assuming that your annotation processor will not play nicely with Lombok.

Recently Lombok worked around this problem with another project and came up with a solution. Maybe that solution could be implemented in Achilles?

A quote from the Lombok release --

PLATFORM: Lombok can now be used together with other annotation processors that are looking for lombok-generated methods, but only if lombok is the first annotation processor executed. The most commonly used annotation processor affected by this change is MapStruct; we've worked with the mapstruct team specifically to allow any order. Other annotation processors might follow the framework we've built to make this possible; point the authors of any such processor to us and we'll get it sorted MapStruct issue #510 Lombok issue #973

Here are some links to the threads where they solved this issue
mapstruct/mapstruct#510
projectlombok/lombok#973

Any thoughts as to whether Achilles could be made compatible?

@doanduyhai
Copy link
Owner

Humm interesting, thanks for the info, let me have a look and come back to you

@kevinmic
Copy link
Author

kevinmic commented Mar 3, 2017

I have been doing a lot of work trying to figure out how this works. I seem to have been able to get Lombok, MapStruct, and Achilles to all work together fine without any changes to any of the projects. I will be exploring this more over the next week or so, so I will update this with my final conclusion.

@kevinmic kevinmic closed this as completed Mar 9, 2017
@Zurvarian
Copy link

Hello,

I'm very interested on this investigation (Heavily using Lombok and Achilles), what's the outcome of your investigation, is there any way to configure a Maven project to make them work properly?

@kevinmic
Copy link
Author

kevinmic commented Apr 4, 2017

I found that using lombok version 1.16.14 and putting it very first in the pom dependencies (and in the managed dependencies) that it works.

@Zurvarian
Copy link

Thanks! I'll try it.

@filiphr
Copy link

filiphr commented Dec 17, 2017

I just found this issue the solution proposed by @kevinmic will work. However, that would work only due to implementation details in the maven and the java annotation processor tool work.

In order to make this work properly, i.e. order independent the other annotation processor needs to get all AstModifyingAnnotationProcessor services on the classpath and check if a type is complete. Lombok implements this SPI and if a type is not complete it would return false, and the annotation processor needs to postpone the processing of that type for the next round (that is actually what MapStruct is doing).

This type is currently in the mapstruct package. However, if there is interest we are more than happy to find an alternative solution for this class and move it to some other package and publish it under some other maven artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants