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-1.9.20.adoc 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. = AspectJ 1.9.20
  2. :doctype: book
  3. :leveloffset: +1
  4. = AspectJ 1.9.20.1
  5. _© Copyright 2023 Contributors. All rights reserved._
  6. _Release info: 1.9.20.1 available 04-Sep-2023_
  7. This is a bugfix release for 1.9.20, fixing two problems:
  8. * https://github.com/eclipse-aspectj/aspectj/issues/257[Regression bug 257] introduced in 1.9.20 would match negated
  9. type patterns like `!void` or `!String[]` incorrectly.
  10. * https://github.com/spring-projects/spring-framework/issues/27761[Spring issue 27761] describes a problem where
  11. AspectJ, when used by Spring AOP, in rare cases falsely considered bridge methods for overridden generic methods for
  12. matching, leading to falsely negative matching results. See also
  13. https://github.com/eclipse-aspectj/aspectj/issues/256[AspectJ tracker issue 256]).
  14. The list of issues addressed for 1.9.20.1 can be found
  15. https://github.com/eclipse-aspectj/aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.20.1[here].
  16. = AspectJ 1.9.20
  17. _© Copyright 2023 Contributors. All rights reserved._
  18. _Release info: 1.9.20 available 16-Aug-2023_
  19. Please note that Bugzilla for issue management is deprecated and new issues should be filed as
  20. https://github.com/eclipse-aspectj/aspectj/issues/new[GitHub issues]. The list of issues addressed for 1.9.20 can be found
  21. here:
  22. * https://github.com/eclipse-aspectj/aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.20[GitHub 1.9.20]
  23. * https://github.com/eclipse-aspectj/aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.20.1[GitHub 1.9.20.1]
  24. * 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.20[Bugzilla 1.9.20]
  25. == New features
  26. AspectJ 1.9.20 supports https://openjdk.java.net/projects/jdk/20/[Java 20] and its final, preview and incubator
  27. features, such as:
  28. * Record patterns (preview)
  29. * Virtual threads (preview)
  30. * Pattern matching for `switch` (preview 3)
  31. * Structured concurrency (incubator)
  32. Please note, that the upstream Eclipse Java Compiler (ECJ), which the AspectJ Compiler (AJC) is a fork of, still has
  33. some open issues concerning Java 20 preview feature support, see the list in
  34. https://github.com/eclipse-aspectj/aspectj/issues/184#issuecomment-1272254940[this comment]. AJC therefore inherits the same
  35. problems for the specific cases described in the linked issues.
  36. == Improvements
  37. * Since Java 9 and the introduction of the Java Module System, the upstream Eclipse Java Compiler (ECJ) and Eclipse Java
  38. Development Tools (JDT) had gone through some internal changes, enabling both the compiler and the IDE to handle new
  39. Java language features. In AspectJ, some of those internal changes have not been properly upgraded for quite a while,
  40. but this is now fixed. However, it might *require you to recompile your aspects and projects/classes using them.*
  41. Otherwise, you might get problems in Eclipse IDE or under certain circumstances even when running newly compiled
  42. aspects in older AspectJ versions and vice versa. You are on the safe side if you simply rebuild your projects. We are
  43. sorry for the inconvenience, but we have to follow upstream ECJ and JDT changes.
  44. * Along with fixing https://github.com/eclipse-aspectj/aspectj/issues/24[GitHub bug 24], the syntax for array type
  45. matching has been improved considerably. You can find some examples
  46. https://github.com/eclipse-aspectj/aspectj/tree/master/tests/bugs1920/github_24[here].
  47. == Code examples
  48. You can find some sample code in the AspectJ test suite under the respective AspectJ version in which the features were
  49. first supported (possibly as JVM preview features):
  50. * https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features198/java17[Pattern matching for switch (preview 1)]
  51. * https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features199/java18[Pattern matching for switch (preview 2)]
  52. * https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features1919/java19[Pattern matching for switch (preview 3),
  53. record patterns (preview 1)]
  54. * https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features1920/java20[Pattern matching for switch (preview 4),
  55. record patterns (preview 2)]
  56. * Please note that presently there is no specific sample code for virtual threads and structured concurrency in the
  57. AspectJ code base, because these are just new APIs, no Java language features. You can find sample code for these
  58. concurrency features elsewhere, e.g. in the corresponding JEPs. In AspectJ, they should just work transparently like
  59. any other Java API.
  60. == Other changes and bug fixes
  61. * About a dozen bugs have been fixed, some of them quite old. See "list of issues addressed" further above and follow
  62. the link to GitHub to find out if your issue is among them.
  63. == AspectJ usage hints
  64. === AspectJ compiler build system requirements
  65. Since 1.9.8, the AspectJ compiler `ajc` (contained in the `aspectjtools` library) no longer works on JDKs 8 to 10. The
  66. minimum compile-time requirement is now JDK 11 due to upstream changes in the Eclipse Java Compiler (subset of JDT
  67. Core), which AspectJ is a fork of. You can still compile to legacy target versions as low as Java 1.3 when compiling
  68. plain Java code or using plain Java ITD constructs which do not require the AspectJ runtime `aspectjrt`, but the
  69. compiler itself needs JDK 11+. Just like in previous AspectJ versions, both the runtime `aspectjrt` and the load-time
  70. weaver `aspectjweaver` still only require JRE 8+.
  71. === Use LTW on Java 16+
  72. Please note that if you want to use load-time weaving on Java 16+, the weaving agent collides with
  73. https://openjdk.java.net/jeps/396[JEP 396 (Strongly Encapsulate JDK Internals by Default)]. Therefore, you need to set
  74. the JVM parameter `--add-opens java.base/java.lang=ALL-UNNAMED` in order to enable aspect weaving. This is due to the
  75. fact that the weaver uses internal APIs for which we have not found an adequate replacement yet when defining classes
  76. in different classloaders.
  77. === Compile with Java preview features
  78. For features marked as preview on a given JDK, you need to compile with `ajc --enable-preview` and run with
  79. `java --enable-preview` on that JDK.
  80. Please note, that you cannot run code compiled with preview features on any other JDK than the one used for compilation.
  81. For example, records compiled with preview on JDK 15 cannot be used on JDK 16 without recompilation. This is a JVM
  82. limitation unrelated to AspectJ. Also, e.g. sealed classes are preview-1 on JDK 15 and preview-2 on JDK 16. You still
  83. need to recompile, no matter what.