Please note that Bugzilla for issue management is deprecated and new issues should be filed as GitHub issues. The list of issues addressed for 1.9.8 can be found here for Bugzilla and here for GitHub issues.
AspectJ 1.9.8 supports Java 17 and its final and preview features, such as:
The --release N compiler option for correct cross-compilation to previous JDK bytecode + API versions is now supported by AJC. Previously, the option existed (inherited by ECJ) but did not work correctly.
The following new properties can improve performance, e.g. Spring start-up time:
For now, they all default to false for backward compatibility. This might change in a future Aspect release, if user feedback is positive and no negative side effects are found. Please try using them as much as you can and report back questions (to the AspectJ users mailing list) or problems (as a GitHub issue), if any. Thanks to Stefan Starke for his contribution. See also PR #37.
You can find some sample code in the AspectJ test suite under the respective AspectJ version in which the features were first supported (possibly as JVM preview features):
Please note that if you want to use load-time weaving on Java 16+, the weaving agent collides with JEP 396 (Strongly Encapsulate JDK Internals by Default). Therefore, you need to set the JVM parameter --add-opens java.base/java.lang=ALL-UNNAMED in order to enable aspect weaving. This is due to the fact that the weaver uses internal APIs for which we have not found an adequate replacement yet when defining classes in different classloaders.
For features marked as preview on a given JDK, you need to compile with ajc --enable-preview and run with java --enable-preview on that JDK.
Please note that you cannot run code compiled with preview features on any other JDK than the one used for compilation. For example, records compiled with preview on JDK 15 cannot be used on JDK 16 without recompilation. This is a JVM limitation unrelated to AspectJ. Also, e.g. sealed classes are preview-1 on JDK 15 and preview-2 on JDK 16. You still need to recompile, no matter what.
Available: 1.9.8 available 11-Feb-2022