aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs153/pr157474
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-23 16:59:17 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-23 18:36:14 +0700
commit79e44360cd95b14fa255daaac069f9b76c488451 (patch)
treee8a0204bd324beec3513768a6e5a83f4137b78ce /tests/bugs153/pr157474
parent6be777e71708df5a62e41c6ef95da66bfd02f447 (diff)
downloadaspectj-79e44360cd95b14fa255daaac069f9b76c488451.tar.gz
aspectj-79e44360cd95b14fa255daaac069f9b76c488451.zip
Make all tests run on Java 16 via '-add-opens' JVM optionjava16-add-opens
Due to JEP 260 (Encapsulate Most Internal APIs), aspect weaving on Java 16 now requires '--add-opens java.base/java.lang=ALL-UNNAMED' on the command line. Otherwise there will be illegal access exceptions for some internal API calls AspectJ needs, most prominently when trying to define classes in other packages or modules. This had to be done on several levels: - Maven Surefire: running tests in a JVM directly forked by Surefire. In order to make this backwards compatible, I added two profiles with JDK-level-dependent auto-activation, one 8-15 and one 16+. In the latter a property containing the JVM parameter is defined, in the former it is empty, i.e. the JVM is started without the parameter. In Java 8 the parameter did not even exist, in Java 9+ we could use it, but we need to test how users use AspectJ. - RunSpec: Whenever an XML test is declared to use '<run>', we need to determine the current JVM version and again dynamically add the parameter when forking the target JVM. - AntSpec: Whenever an XML test is declared to use '<ant>', we need to determine the current JVM version dynamically add two properties usable from within Ant scripts: 'aj.addOpensKey' and 'aj.addOpensValue'. Unfortunately, Ant needs to use two '<argLine>' parameters, because the two parts of the option are separated by a space character. - Ant scripts: When triggered by an AntSpec, each Ant target using LTW needs to manually set <jvmarg value="${aj.addOpensKey}"/> <jvmarg value="${aj.addOpensValue}"/> for each '<java>' task. It was quite tedious to find all(?) of them. TODO: In the AspectJ 1.9.7 release notes we need to document that this parameter is now needed for LTW. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/bugs153/pr157474')
-rw-r--r--tests/bugs153/pr157474/ant-server.xml6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/bugs153/pr157474/ant-server.xml b/tests/bugs153/pr157474/ant-server.xml
index af315984a..73db721c9 100644
--- a/tests/bugs153/pr157474/ant-server.xml
+++ b/tests/bugs153/pr157474/ant-server.xml
@@ -9,16 +9,18 @@
<target name="TestServer with duplicate configuration">
<copy file="${aj.root}/tests/bugs153/pr157474/server-applicationandlibrary.properties"
tofile="${aj.sandbox}/server.properties"/>
-
+
<mkdir dir="${aj.sandbox}/Application"/>
<copy file="${aj.root}/tests/bugs153/pr157474/aop-application.xml"
tofile="${aj.sandbox}/Application/META-INF/aop.xml"/>
-
+
<java fork="yes" classname="org.aspectj.testing.server.TestServer" failonerror="yes">
<classpath refid="aj.path"/>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<!-- <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
<arg path="${aj.sandbox}"/>
</java>