You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README-196.html 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  2. <html> <head>
  3. <title>AspectJ 1.9.6 Readme</title>
  4. <style type="text/css">
  5. <!--
  6. P { margin-left: 20px; }
  7. PRE { margin-left: 20px; }
  8. LI { margin-left: 20px; }
  9. H4 { margin-left: 20px; }
  10. H3 { margin-left: 10px; }
  11. -->
  12. </style>
  13. </head>
  14. <body>
  15. <div align="right"><small>
  16. &copy; Copyright 2020 Contributors.
  17. All rights reserved.
  18. </small></div>
  19. <h1>AspectJ 1.9.6</h1>
  20. <p>The full list of resolved issues in 1.9.6 is available
  21. <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>
  22. <p>AspectJ 1.9.6 supports Java14. Java14 introduces records, but you must activate support for that via
  23. an <tt>--enable-preview</tt> flag when using the compiler and attempting to run the resultant classes:
  24. Here is <tt>Code.java</tt>:
  25. <pre><code>
  26. =======8<=========
  27. public record Person(String firstName, String lastName, int age) {}
  28. =======8<=========
  29. =======8<=========
  30. public class UsingPersonRecord {
  31. public static void main(String[] argv) {
  32. Person p = new Person("A","B",99);
  33. System.out.println(p);
  34. System.out.println(p.firstName());
  35. }
  36. }
  37. =======8<=========
  38. =======8<=========
  39. public aspect TraceRecordComponents {
  40. before(): execution(public * *()) {
  41. System.out.println(thisJoinPointStaticPart);
  42. }
  43. }
  44. =======8<=========
  45. </code></pre>
  46. <p>Compile it with:
  47. <pre><code>
  48. $ ajc --enable-preview -14 Person.java UsingPersonRecord.java TraceRecordComponents.java
  49. </code></pre>
  50. <p>Now run it:
  51. <pre><code>
  52. $ java --enable-preview UsingPersonRecord
  53. execution(String Person.toString())
  54. Person[firstName=A, lastName=B, age=99]
  55. execution(String Person.firstName())
  56. A
  57. </code></pre>
  58. <p>Available: 1.9.6 available 22-Jul-2020</p>
  59. <br><br>
  60. <!-- ============================== -->
  61. </body>
  62. </html>