aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tracing
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2024-01-28 16:13:22 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2024-01-29 07:07:26 +0700
commitf986c3d18386e77c974e4272ab27c3b573773c9b (patch)
tree542e0be08b7f34133dc9813cef864e5bfb75e31d /tests/tracing
parent8b3a50e5ab8d78e96dd4401081388bc34c17edf4 (diff)
downloadaspectj-f986c3d18386e77c974e4272ab27c3b573773c9b.tar.gz
aspectj-f986c3d18386e77c974e4272ab27c3b573773c9b.zip
Workaround for defining classes during LTW
Overhaul ClassLoaderWeavingAdaptor to use statically initialised Unsafe instances and method handles pointing to their 'defineClass' methods. Those now work universally on JDKs 8-21. In older JDKs, the method used to be in sun.misc.Unsafe, in more recent ones on jdk.internal.misc.Unsafe. It is challenging to fetch instances, especially as reflection protection and module boundaries have been increased in the JDK progressively. But finally, a solution was adapted from Byte Buddy (BB). Kudos to BB author Rafael Winterhalter. The previous solution to use ClassLoader::defineClass and require '--add-opens' is no longer necessary for the first time since it became necessary in AspectJ 1.9.7 with Java 16 support. Add org.ow2.asm:asm-common as a dependency everywhere org.ow2.asm:asm was used before. Maybe that is too many places, but no worse than before. Add missing dependency on loadtime to aspectjweaver. This kept a build like "mvn install -am -pl aspectjweaver" from picking up changed loadtime classes. Fixes #117. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/tracing')
-rw-r--r--tests/tracing/ant.xml16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/tracing/ant.xml b/tests/tracing/ant.xml
index 6e0ddd78e..687d41b10 100644
--- a/tests/tracing/ant.xml
+++ b/tests/tracing/ant.xml
@@ -33,8 +33,8 @@
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
@@ -48,8 +48,8 @@
<!-- <jvmarg value="-verbose:class"/>-->
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
@@ -63,8 +63,8 @@
<jvmarg value="-Djava.util.logging.config.file=logging.properties"/>
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
@@ -76,8 +76,8 @@
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
<!-- <jvmarg value="-verbose:class"/>-->
<!-- use META-INF/aop.xml style -->
<!-- <jvmarg line="${jdwp}"/>-->