12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
- <html> <head>
- <title>AspectJ 1.9.6 Readme</title>
- <style type="text/css">
- <!--
- P { margin-left: 20px; }
- PRE { margin-left: 20px; }
- LI { margin-left: 20px; }
- H4 { margin-left: 20px; }
- H3 { margin-left: 10px; }
- -->
- </style>
- </head>
-
- <body>
- <div align="right"><small>
- © Copyright 2020 Contributors.
- All rights reserved.
- </small></div>
- <h1>AspectJ 1.9.6</h1>
- <p>The full list of resolved issues in 1.9.6 is available
- <a href="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</a></h2>.</p>
-
- <p>AspectJ 1.9.6 supports Java14. Java14 introduces records, but you must activate support for that via
- an <tt>--enable-preview</tt> flag when using the compiler and attempting to run the resultant classes:
-
- Here is <tt>Code.java</tt>:
- <pre><code>
- =======8<=========
- public record Person(String firstName, String lastName, int age) {}
- =======8<=========
-
- =======8<=========
- 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());
- }
- }
- =======8<=========
-
- =======8<=========
- public aspect TraceRecordComponents {
- before(): execution(public * *()) {
- System.out.println(thisJoinPointStaticPart);
- }
- }
- =======8<=========
- </code></pre>
-
- <p>Compile it with:
- <pre><code>
- $ ajc --enable-preview -14 Person.java UsingPersonRecord.java TraceRecordComponents.java
- </code></pre>
-
- <p>Now run it:
- <pre><code>
- $ java --enable-preview UsingPersonRecord
- execution(String Person.toString())
- Person[firstName=A, lastName=B, age=99]
- execution(String Person.firstName())
- A
- </code></pre>
-
- <p>Available: 1.9.6 available 22-Jul-2020</p>
-
- <br><br>
-
-
- <!-- ============================== -->
- </body>
- </html>
|