aboutsummaryrefslogtreecommitdiffstats
path: root/docs/release/README-1.9.6.adoc
blob: 3f22fbd3eceb5f68e0d7588e989ffd7892739764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
= AspectJ 1.9.6

_© Copyright 2020 Contributors. All rights reserved._

The full list of resolved issues in 1.9.6 is available
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.6[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`:

[source, 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:

[source, text]
....
$ ajc --enable-preview -14 Person.java UsingPersonRecord.java TraceRecordComponents.java
....

Now run it:

[source, text]
....
$ java --enable-preview UsingPersonRecord
execution(String Person.toString())
Person[firstName=A, lastName=B, age=99]
execution(String Person.firstName())
A
....