Lombok not working with AspectJ

2,979 views
Skip to first unread message

abhin4v

unread,
Dec 2, 2009, 1:25:54 PM12/2/09
to Project Lombok
Hi,
I am trying to use Lombok annotation on a class which is advised by
AspectJ. I put the Lombok annotations on the class but the compiled
class file does not have any generated getters and setters. I am using
Eclipse 3.4 with AJDT plug-in.

I checked the .project file of the project. It has the AspectJ builder
tags rather than the Java builder tag. If I add the Java builder tags
to the file then Lombok works but Aspects are not woven in. It seems
that AspectJ Builder does not invoke the Lombok annotation processor
and Java builder overrides the Aspect woven classes.

Please tell me how I can solve this problem.

--
Abhinav

Reinier Zwitserloot

unread,
Dec 2, 2009, 3:41:46 PM12/2/09
to Project Lombok
Yeah, lombok and AspectJ don't play well together. We haven't
investigated if we can (easily) solve this problem, so don't hold your
breath :(

abhinav sarkar

unread,
Dec 2, 2009, 3:57:55 PM12/2/09
to project...@googlegroups.com
I worked out a possible solution: using delombok to generate source files first (with generated getter and setters) and then compiling those files with ajc. This does the trick. However, I have to do this manually because I am not really good at Ant. Maybe someone can write an Ant task to do this automatically.

--
Abhinav

--
You received this message because you are subscribed to the Google
Groups group for http://projectlombok.org/

To post to this group, send email to project...@googlegroups.com
To unsubscribe from this group, send email to
project-lombo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/project-lombok?hl=en

Reinier Zwitserloot

unread,
Dec 2, 2009, 4:50:39 PM12/2/09
to project-lombok
There's an ant task for delombok already (see http://projectlombok.org/features/delombok.html) Not sure if there is one for ajc.

--Reinier Zwitserloot

scipio

unread,
Dec 7, 2009, 6:56:18 PM12/7/09
to Project Lombok
On Dec 2, 3:41 pm, Reinier Zwitserloot <reini...@gmail.com> wrote:
> Yeah, lombok and AspectJ don't play well together. We haven't
> investigated if we can (easily) solve this problem, so don't hold your
> breath :(

I have no idea what would be required to address this, but maybe
you and the AspectJ guys could talk it over. More than half of my
projects
use AspectJ in one way or another, and I would love to use Lombok
with them too! Otherwise, nice work!

abhinav sarkar

unread,
Dec 8, 2009, 2:01:53 AM12/8/09
to project...@googlegroups.com
AspectJ has a bug filed for adding support for jsr299 (Annotation processor) [https://bugs.eclipse.org/bugs/show_bug.cgi?id=252199]. In the last comment, Andy Clement says that he has a working prototype but he won't release it until it becomes a "more requested feature". I think we can urge him to roll out this feature in the next release of AspectJ. This should solve lombok's problem with AspectJ.

--
You received this message because you are subscribed to the Google
Groups group for http://projectlombok.org/

To post to this group, send email to project...@googlegroups.com
To unsubscribe from this group, send email to
project-lombo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/project-lombok?hl=en



--

Sent from Bangalore, KA, India

Reinier Zwitserloot

unread,
Dec 8, 2009, 11:33:09 AM12/8/09
to Project Lombok
It might help, at least with javac, but it might not. Lombok is not
really an annotation processor. We just use a part of it to start
lombok. However, if ajc doesn't work at all with annotation
processors, I'd suggest you move on. AspectJ has been around for years
and years, and so has annotation processing. If AspectJ can't be arsed
to fix something so basic, given the resources they should have picked
up by now, then I can only conclude it's a sinking ship.

At any rate, I seriously doubt them fixing annotation processors will
have any effect on lombok's interaction with the aspectJ plugin on
eclipse. Maybe the run javac internally and that's causing the problem
(in which case, yes, them supporting annotation processors might
actually work!)

It's an itch problem; neither Roel nor I use AspectJ, so fixing it
means us putting in our increasingly limited free time first
installing aspectJ, figuring out what it does, fixing the problem, all
for absolutely no return whatsoever except for slightly more lombok
eyeballs. If that's the goal, doing something like adding IntelliJ
support (also something we don't use) is far more efficient.

Hence, and I don't see this to be mean, just to be honest: We aren't
going to look into this. I'd love to have the time to do so, but the
list of things to work on for lombok is as long as my leg, and fixing
AspectJ interaction can't hold a candle to the other things on the
long list. Making lombok open source and free has mostly worked out,
but it does mean that stuff like this means other folks need to jump
in and sort this out. If we get patches to address this issue we'll
gladly accept them and if you need help from us while working on a
patch, we'll be glad to help there too.
> > Groups group forhttp://projectlombok.org/
>
> > To post to this group, send email to project...@googlegroups.com
> > To unsubscribe from this group, send email to
> > project-lombo...@googlegroups.com<project-lombok%2Bunsubscribe@go oglegroups.com>

G

unread,
Sep 20, 2011, 2:00:33 PM9/20/11
to project...@googlegroups.com
Given something like https://bugs.eclipse.org/bugs/show_bug.cgi?id=169857 is it more likely for lombok to work with aspectj as annotation processor ?

Reinier Zwitserloot

unread,
Sep 20, 2011, 2:04:32 PM9/20/11
to project...@googlegroups.com
Annotation Processors can't do what lombok does. Maybe we can make something happen if we turn lombok into a CompilationParticipant. Something to investigate later.

Reply all
Reply to author
Forward
0 new messages