© Copyright 2020 Contributors. All rights reserved.
The full list of resolved issues in 1.9.6 is available here
Release info: 1.9.6 available 22-Jul-2020
AspectJ 1.9.6 supports Java14. Java14 introduces records, but you must
activate support for that via an --enable-preview
flag when using the
compiler and attempting to run the resultant classes: Here is Code.java
:
public record Person(String firstName, String lastName, int age) {}
public class UsingPersonRecord {
public static void main(String[] argv) {
Person p = new Person("A","B",99);
System.out.println(p);
System.out.println(p.firstName());
}
}
public aspect TraceRecordComponents {
before(): execution(public * *()) {
System.out.println(thisJoinPointStaticPart);
}
}
Compile it with:
$ ajc --enable-preview -14 Person.java UsingPersonRecord.java TraceRecordComponents.java
Now run it:
$ java --enable-preview UsingPersonRecord
execution(String Person.toString())
Person[firstName=A, lastName=B, age=99]
execution(String Person.firstName())
A