0

My AspectJ version is still on 1.6.8 running on a Java 6 Project.

Suppose I migrate to Java 8.

Should I update the AspectJ version? Is it mandatory?

If yes, are there things I have to be aware of?

Ayoub Rossi
  • 410
  • 5
  • 18

1 Answers1

0

This question was flagged as a duplicate before, but I voted to re-open it because the other question was about AspectJ Maven Plugin compatibility with Java 8 and the answers there do not explain anything explicitly in order to answer this question.

AspectJ 1.6.x was published for Java 6, just as AspectJ 1.7.x was for Java 7, 1.8.x for Java 8, 1.9.x for Java 9-13 at the date of writing this.

Having said that, you should consider the following:

  • If you would just use the Java 8 compiler but compile your Java 6 code with target 1.6, in theory you could continue using AspectJ 1.6.8 (e.g. runtime) too.
  • But as soon as you compile with target 1.8 and/or use Java 8 language features, you have to use AspectJ 1.8.x (I recommend the latest version) at least in order to make the AspectJ compiler and weaver understand those language features and the byte code at all.
  • I would even recommend to use the latest 1.9.x version, it is backward compatible and might have a few bug fixes missing in 1.8.x. But that is an optional choice. I always use the latest AspectJ version even in Java 8.
kriegaex
  • 63,017
  • 15
  • 111
  • 202