javaeclipseaopaspectjajdt

Migrating a Java project to AspectJ (Eclipse AJDT)


I'm working on a Java 1.8 project with several modules and one huge cross-cutting concern - logs are present in almost every class, in every module. I recently read about Aspect Oriented Programming (AOP) and I though it would be nice to use AspectJ to make things more modular, just like the guy from this post did. I decided to give it a try...

Since I'm using Eclipse Oxygen and it isn't compatible with the latest AJDT, I've downloaded Eclipse Kepler and the latest AJDT. However, I've noticed that once AJDT was installed, all Java Compiller's settings were set to J2SE-1.4, and I couldn't put it back to 1.8, since this option was not available anymore on the IDE. This caused me a lot of compiler's errors, such as:

Build path specifies execution environment J2SE-1.4. There are no JREs installed in the workspace that are strictly compatible with this environment.

and

'<>' operator is not allowed for source level below 1.7

I have the feeling that AJDT is outdated and incompatible with the latest java versions. However, since this is the first time I'm trying to use AOP, I wonder if I'm not following the correct path...

So, to make it simple and direct, my question is - is it possible to use AJDT with Java 1.8 (maybe manually (directly on a text file) editting some workspace configuration instead of using the IDE's UI, or something like that)? Or, to use AJDT, I'll need to make my project compatible with older Java versions, by "fixing", for instance, the <> operators, among several other things adopted by the latest versions of Java?


Solution

  • AJDT has a development build for Eclipse Oxygen (4.7), see https://eclipse.org/ajdt/downloads/

    AJDT dev builds for Eclipse 4.7

    Update Site URL:http://download.eclipse.org/tools/ajdt/47/dev/update

    I just created a HelloWorld test project with aspects in Oxygen, and it runs under Java 8.