= AspectJ 1.9.7

_© Copyright 2021 Contributors. All rights reserved._

_Release info: 1.9.7 available 24-Jun-2021_

AspectJ (binaries, source code, documentation) is now distributed under
the https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt[Eclipse
Public License v 2.0].

Please note, that going forward Bugzilla for issue management is
deprecated, and new issues should be filed as
https://github.com/eclipse-aspectj/aspectj/issues/new[GitHub issues]. The
list of issues addressed for 1.9.7 can be found
https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&f0=OP&f1=OP&f3=CP&f4=CP&j1=OR&list_id=16866879&product=AspectJ&query_format=advanced&target_milestone=1.9.7[here
for Bugzilla] and
https://github.com/eclipse-aspectj/aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.7[here
for GitHub issues].

== New features

AspectJ 1.9.7 supports https://openjdk.java.net/projects/jdk/15/[Java
15] & https://openjdk.java.net/projects/jdk/16/[Java 16] and their
respective final and review features:

* text blocks (final 15)
* records (preview 15, final 16)
* instanceof pattern matching (preview 15, final 16)
* hidden classes (final 15)
* sealed classes (preview 15, preview 16)

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.

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):

* https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features195/textblock[AspectJ
1.9.5: text blocks]
* https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features196/java14[AspectJ
1.9.6: records, instanceof patterns]
* https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features197/java15[AspectJ
1.9.7: hidden classes, sealed classes]

== Using LTW on Java 16+

Please note that if you want to use load-time weaving on Java 16+, the
weaving agent collides with https://openjdk.java.net/jeps/396[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.

== Organisational and internal changes

For AspectJ 1.9.7, we implemented a lot of internal changes concerning
the build and release process, most of which are not visible in the
product itself but will help us to more easily maintain and release the
product in the future and more easily on-boarding new developers or
contributors. For example:

* The main repository has been moved to
https://github.com/eclipse/org.aspectj[GitHub], i.e. you can open bug
reports, feature requests and pull requests there now.
* The Maven build has been improved, i.e. it is now easier to build and
contribute to the product. Developers can just import the Maven project
and no longer depend on Eclipse to build and test AspectJ, but can e.g.
also use IntelliJ IDEA.
* Continuous integration builds now run on GitHub for different JDK
versions, also for pull requests. I.e. both maintainers and contributors
get to know if their changes break any tests.
* We can build releases and deploy them directly to Sonatype OSSRH
(snapshots) or Maven Central (releases) with Maven now, i.e. it should
be much easier in the future to publish development versions in order to
enable users to re-test fixed bugs or try new features.
* All tests are portable now, i.e. they correctly run on Windows, too.
This enables developers and contributors to make a choice if they want
to work on Linux or on Windows.

== Other changes and bug fixes

* Remove legacy JRockit support.
* Support Windows 10 and Windows Server 2016/2019 in installer. Those
versions were not detected until now, which led to bogus Windows batch
files forwarding only 9 AJC parameters to the Java process via `%1 %2 %3
%4 %5 %6 %7 %8 %9` instead of `%*`.
* AJdoc (AspectJ's javadoc generator add-on for aspects) now supports
the JDK 16 javadoc generator.
* Fix `serialVersionUID` initialization for Java 9+
* AJC (AspectJ Compiler) usage texts sometimes used to be printed twice
and they were printed too often, e.g. on top of every compile error.
This has been fixed. Furthermore, the partly outdated usage text is now
basically the same as ECJ (Eclipse Java Compiler), which AJC is a fork
of, plus AspectJ-specific additions which are added during runtime.
* Source and javadoc JARs distributed together with the AspectJ
artifacts on Maven Central are now more accurate and more complete with
regard to what is included (ASM, JDT Core) and how package names have
been relocated.
* Fix sample code formatting issues (indentation) throughout the
documentation.
