aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/ataspectj/ajc-ant.xml
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/java5/ataspectj/ajc-ant.xml
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/java5/ataspectj/ajc-ant.xml')
-rw-r--r--tests/java5/ataspectj/ajc-ant.xml69
1 files changed, 35 insertions, 34 deletions
diff --git a/tests/java5/ataspectj/ajc-ant.xml b/tests/java5/ataspectj/ajc-ant.xml
index 9fa620572..285082612 100644
--- a/tests/java5/ataspectj/ajc-ant.xml
+++ b/tests/java5/ataspectj/ajc-ant.xml
@@ -24,8 +24,8 @@
<!-- use META-INF/aop.xml style -->
<classpath path="ataspectj/pathentry"/>
<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>
@@ -36,8 +36,8 @@
<java fork="yes" classname="ataspectj.PerClauseTest" failonerror="yes">
<classpath refid="aj.path"/>
<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 @@
<java fork="yes" classname="ataspectj.AroundInlineMungerTest" failonerror="yes">
<classpath refid="aj.path"/>
<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}"/>--><!-- uncomment to debug with JDWP -->
</java>
</target>
@@ -60,8 +60,8 @@
<java fork="yes" classname="ataspectj.AroundInlineMungerTest2" failonerror="yes">
<classpath refid="aj.path"/>
<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}"/>-->
</java>
</target>
@@ -69,8 +69,8 @@
<java fork="yes" classname="ataspectj.DumpTest" failonerror="yes">
<classpath refid="aj.path"/>
<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}"/>-->
</java>
</target>
@@ -80,8 +80,8 @@
<java fork="yes" classname="ataspectj.TestProxyGenerator" failonerror="yes">
<classpath refid="aj.path"/>
<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}"/>-->
</java>
</target>
@@ -101,8 +101,8 @@
<pathelement path="${aj.sandbox}/main1.jar"/>
</classpath>
<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}"/>-->
</java>
</target>
@@ -119,8 +119,8 @@
<java fork="yes" classname="ataspectj.ltwlog.MainSilent" failonerror="yes">
<classpath refid="aj.path"/>
<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}"/>-->
</java>
<copy file="ataspectj/ltwlog/aop-verbsoe.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"
@@ -129,8 +129,8 @@
<java fork="yes" classname="ataspectj.ltwlog.MainVerbose" failonerror="yes">
<classpath refid="aj.path"/>
<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}"/>-->
</java>
<copy file="ataspectj/ltwlog/aop-verboseandshow.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"
@@ -139,8 +139,8 @@
<java fork="yes" classname="ataspectj.ltwlog.MainVerboseAndShow" failonerror="yes">
<classpath refid="aj.path"/>
<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}"/>-->
</java>
</target>
@@ -160,6 +160,7 @@
<path refid="aj.path"/>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <!-- Necessary, because the test (not AspectJ itself!) uses ClassLoader::defineClass -->
<jvmarg value="${aj.addOpensKey}"/>
<jvmarg value="${aj.addOpensValue}"/>
</java>
@@ -175,8 +176,8 @@
<path refid="aj.path"/>
</classpath>
<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}"/>-->
</java>
<copy file="ataspectj/aop-decptest.xml"
@@ -188,8 +189,8 @@
<path refid="aj.path"/>
</classpath>
<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}"/>-->
</java>
</target>
@@ -211,8 +212,8 @@
<path refid="aj.path"/>
</classpath>
<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}"/>-->
</java>
</target>
@@ -230,8 +231,8 @@
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-DaspectDeclared=true"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
</java>
<!--Now ensure that the error is not produced when the declaration is made.-->
<copy file="ataspectj/ltwreweavable/aop-ltwreweavable-omitted.xml"
@@ -244,8 +245,8 @@
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-DaspectDeclared=false"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
</java>
</target>
@@ -273,8 +274,8 @@
<classpath refid="aj.path"/>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-Daj.weaving.verbose=true"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
</java>
</target>
@@ -291,8 +292,8 @@
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Djava.util.logging.config.file=${aj.root}/weaver5/testdata/logging.properties"/>
- <jvmarg value="${aj.addOpensKey}"/>
- <jvmarg value="${aj.addOpensValue}"/>
+<!-- <jvmarg value="${aj.addOpensKey}"/>-->
+<!-- <jvmarg value="${aj.addOpensValue}"/>-->
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>