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.8.adoc 5.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. = AspectJ 1.9.8
  2. _© Copyright 2022 Contributors. All rights reserved._
  3. _Release info: 1.9.8 available 11-Feb-2022_
  4. Please note, that Bugzilla for issue management is deprecated, and new issues should be filed as
  5. https://github.com/eclipse-aspectj/aspectj/issues/new[GitHub issues]. The list of issues addressed for 1.9.8 can be found
  6. 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.8[here for Bugzilla] and
  7. https://github.com/eclipse-aspectj/aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.8[here for GitHub issues].
  8. == New features
  9. AspectJ 1.9.8 supports https://openjdk.java.net/projects/jdk/17/[Java 17] and its final and review features, such as:
  10. * Sealed classes (final in Java 17, previews in Java 15, 16 and AspectJ 1.9.7)
  11. * Pattern matching for `switch`
  12. == Improvements
  13. The `--release N` compiler option for correct cross-compilation to previous JDK bytecode + API versions is now supported
  14. by AJC. Previously, the option existed (inherited by ECJ) but did not work correctly.
  15. The following new properties can improve performance, e.g. Spring start-up time:
  16. * `org.aspectj.apache.bcel.useSingleRepositoryInstance`
  17. * `org.aspectj.apache.bcel.useUnavailableClassesCache`
  18. * `org.aspectj.apache.bcel.ignoreCacheClearRequests`
  19. For now, they all default to `false` for backward compatibility. This might change in a future Aspect release, if user
  20. feedback is positive and no negative side effects are found. Please try using them as much as you can and report back
  21. questions (to the AspectJ users mailing list) or problems (as a GitHub issue), if any. Thanks to Stefan Starke for his
  22. contribution. See also https://github.com/eclipse-aspectj/aspectj/pull/37[PR #37].
  23. == Code examples
  24. You can find some sample code in the AspectJ test suite under the respective AspectJ version in which the features were
  25. first supported (possibly as JVM preview features):
  26. * https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features198/compiler_release[Cross-compilation to legacy JDK]:
  27. An example class which only works correctly on JDK 8 when compiled with `--release 8` due to API changes in
  28. the JDK. Simply `-source 8 -target 8` would not be enough in this case.
  29. * https://github.com/eclipse-aspectj/aspectj/tree/master/tests/features198/java17[Pattern matching for `switch`]
  30. == Other changes and bug fixes
  31. * The AspectJ compiler `ajc` (contained in the `aspectjtools` library) no longer works on JDKs 8 to 10. The minimum
  32. compile-time requirement is now JDK 11 due to upstream changes in the Eclipse Java Compiler (subset of JDT Core),
  33. which AspectJ is a fork of. You can still compile to legacy target versions as low as Java 1.3 when compiling plain
  34. Java code or using plain Java ITD constructs which do not require the AspectJ runtime `aspectjrt`, but the compiler
  35. itself needs JDK 11+. Just like in previous AspectJ versions, both the runtime `aspectjrt` and the load-time weaver
  36. `aspectjweaver` still only require JRE 8+.
  37. * Document build profiles and properties in _docs/developer/BUILD.md_
  38. * Add a guide for setting up an AspectJ development environment in _docs/developer/IDE.md_
  39. * Fix https://github.com/eclipse-aspectj/aspectj/issues/105[issue #105]: Compilation fails when using an aspect library via
  40. `-aspectpath` in combination with introducing an annotation via ITD. This was broken since version 1.9.5 and fixed in
  41. 1.9.8.RC3.
  42. * Fix https://github.com/eclipse-aspectj/aspectj/issues/68[issue #68]: Correctly process class files containing
  43. https://openjdk.java.net/jeps/309[dynamic class-file constants (JEP 309)], which were introduced in Java 11 and broken
  44. in AspectJ ever since their introduction in 1.9.2. Java itself currently does not use "condy" and neither do other
  45. widespread JVM languages. Byte code engineering libraries like ASM or Byte Buddy and some instrumentation tools like
  46. JaCoCo can however produce condy code. Therefore, in order to create a regression test, we actually had to
  47. https://github.com/eclipse-aspectj/aspectj/blob/de63b63d/tests/bugs198/github_68/Generator.java#L50-L61[craft a condy
  48. class with ASM].
  49. * Thanks to Andrey Turbanov for several clean code contributions and to Dmitry Mikhaylov for fixing a potential
  50. concurrency problem.
  51. == AspectJ usage hints
  52. === Use LTW on Java 16+
  53. Please note that if you want to use load-time weaving on Java 16+, the weaving agent collides with
  54. https://openjdk.java.net/jeps/396[JEP 396 (Strongly Encapsulate JDK Internals by Default)]. Therefore, you need to set
  55. the JVM parameter `--add-opens java.base/java.lang=ALL-UNNAMED` in order to enable aspect weaving. This is due to the
  56. fact that the weaver uses internal APIs for which we have not found an adequate replacement yet when defining classes
  57. in different classloaders.
  58. **Update:** As of AspectJ 1.9.21.1, `--add-opens` is no longer necessary. Please upgrade, if it bothers you too much.
  59. === Compile with Java preview features
  60. For features marked as preview on a given JDK, you need to compile with `ajc --enable-preview` and run with
  61. `java --enable-preview` on that JDK.
  62. Please note, that you cannot run code compiled with preview features on any other JDK than the one used for compilation.
  63. For example, records compiled with preview on JDK 15 cannot be used on JDK 16 without recompilation. This is a JVM
  64. limitation unrelated to AspectJ. Also, e.g. sealed classes are preview-1 on JDK 15 and preview-2 on JDK 16. You still
  65. need to recompile, no matter what.