But I want/need to use AspectJ in my project. Does that mean I cannot use Lombok? Is there any way to make the two play nicely together?
I presume it is because aspectj uses ajc as a compiler and not javac, but I wouldn't know what to look at further then that. Can Lombok even be made to work with ajc?
Thanks,
Eric
The problem is probable the one I described here:
https://weblogs.java.net/blog/fabriziogiudici/archive/2011/07/19/making-lombok-aspectj-and-maven-co-exist
AspectJ by default works on the sources, calling the compiler by itself and then operating on the byte code. The workaround is to switch it to another operating mode, that is leaving the compiler alone and having Aspectj to work on the byte code produced by it.
If you're using Ant, you should be able to find the solution there. If you use Maven, the solution for Maven in the blog post is quite old, and in the meantime the Maven plugin bug has been fixed. You might wnat to look at the solution in the profile
it.tidalwave-aspectj-springaop-v1
in this super POM
https://bitbucket.org/tidalwave/thesefoolishthings-superpom-src/src/65d85b8086ec87fb09ad64ab8221a1174a2dbd88/pom.xml?at=2.15
Actually, the latter thing is the solution I'm currently working. It works by forcing AspectJ to ignore the position of sources (see <!-- Prevent ajc from finding sources -->), so it switches working on the bytecode.
Let me know if this works for you.
The problem is that Lombok is an innovation outside the original scope of annotations. I think we should lobby a lot to have Oracle and other partners to recognize it's a useful tool and provide explicit support for it.
The problem is that Lombok is an innovation outside the original scope of
annotations. I think we should lobby a lot to have Oracle and other
partners to recognize it's a useful tool and provide explicit support for
it.
I disagree. Nearly everything what Lombok does should be part of Java. I
But it isn't, right? The process of evolving Java is unavoidable bureaucratic and slow and unavoidably doesn't satisfy a lot of people because it must produce a single Java.
OTOH with Lombok one can choose how to extend the language (not counting what you say below, that a further enhancement might make really easy for everybody to design his own annotations). That's why I see a reason for Lombok even in the long time.
I'm a lecturer in Victoria University of Wellington and I'm in the
process of designing a java-like programming language that should
offer good support for lombok-like annotation/class decorators...
If someone is interested, I'm happy do discuss about it!