Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ with Lombok?

As a followup, I posted the question on SO (http://stackoverflow.com/q/25903686/827480) and emailed the Lombok list as well.  Both places pointed me to the following blog:
https://weblogs.java.net/blog/fabriziogiudici/archive/2011/07/19/making-lombok-aspectj-and-maven-co-exist

Fabrizio suggests having javac compile the sources first, and then have ajc weave using the javac byte code as the input and not the source code.  This would avoid requiring ajc to understand Lombok annotations b/c the javac would have already compiled in the necessary methods.

For basic around/etc pointcut aspects, I see that as a feasible workaround.  However, I don't see that working with ITD aspects (member injection/interface implementation/etc).  Javac will never properly finish compiling code that relys on ITD members since as far as javac is concerned, they don't exist yet.

Which makes this sound like a pretty nasty race condition.

I'm not quite sure which team to discuss this with - if it is an ajc issue, or a lombok issue.

Thanks,

Eric



On Wed, Sep 17, 2014 at 11:27 PM, Eric B <ebenzacar@xxxxxxxxx> wrote:
I'm trying to use Lombok (http://projectlombok.org/) in an AspectJ project, but when I enable AspectJ, none of my generated lombok code is added to my byte code.

I'm not entirely sure how lombok interacts with Javac, but my guess is that the ajc compiler does not recognize lombok the way javac does.

Is there anyway to make these two play nicely?  Can I configure ajc to use/recognize lombok properly?  Or am I forced to pick only one of the two technologies?

Thanks,

Eric



Back to the top