<module>installer</module>
</modules>
+ <!--
+ Caveat: Automatic, JDK-based profile activation can *not* be inherited by child POMs defining
+ the same profiles. Thus, we have to repeat activation conditions there.
+
+ Note: We can check if automatic profile activation works via mvn help:active-profiles.
+ -->
+ <profiles>
+ <profile>
+ <id>jdk-8-to-15</id>
+ <activation>
+ <jdk>[1.8,16)</jdk>
+ </activation>
+ <properties>
+ <jvm.arg.addOpens/>
+ </properties>
+ </profile>
+ <profile>
+ <id>jdk-16-to-xx</id>
+ <activation>
+ <jdk>[16,)</jdk>
+ </activation>
+ <properties>
+ <jvm.arg.addOpens>--add-opens java.base/java.lang=ALL-UNNAMED</jvm.arg.addOpens>
+ </properties>
+ </profile>
+ </profiles>
+
<build>
+
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
-<!--
- <testFailureIgnore>true</testFailureIgnore>
--->
+ <!--<testFailureIgnore>true</testFailureIgnore>-->
+ <argLine>${jvm.arg.addOpens}</argLine>
<excludes>
<exclude>**/*ModuleTests.java</exclude>
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-help-plugin</artifactId>
+ <version>3.2.0</version>
+ </plugin>
</plugins>
</pluginManagement>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
</configuration>
<executions>
<execution>
-<id>test-jar</id>
+ <id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
<fileset>
<directory>.</directory>
<includes>
-<include>**/ajcore.*.txt</include>
-
- </includes>
+ <include>**/ajcore.*.txt</include>
+ </includes>
<!--
-<excludes> <exclude>**/important.log</exclude> <exclude>**/another-important.log</exclude>
- </excludes> -->
+ <excludes>
+ <exclude>**/important.log</exclude>
+ <exclude>**/another-important.log</exclude>
+ </excludes>
+-->
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>aj-build</directory>
- <!-- <includes> <include>**/*.tmp</include> <include>**/*.log</include>
- </includes> <excludes> <exclude>**/important.log</exclude> <exclude>**/another-important.log</exclude>
- </excludes> -->
+<!--
+ <includes>
+ <include>**/*.tmp</include>
+ <include>**/*.log</include>
+ </includes>
+ <excludes>
+ <exclude>**/important.log</exclude>
+ <exclude>**/another-important.log</exclude>
+ </excludes>
+-->
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
+ <!--
+ This plugin is nice to have in the POM, because then it is easy to double-click a goal such as 'effective-pom',
+ 'active-profiles', 'effective-settings' or 'evaluate' from a modern IDE in order to get quick information about
+ the current build configuration for any given module.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-help-plugin</artifactId>
+ </plugin>
+
</plugins>
</build>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
+ <argLine>${jvm.arg.addOpens}</argLine>
</configuration>
<executions>
<execution>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
+ <argLine>${jvm.arg.addOpens}</argLine>
</configuration>
<executions>
<execution>
</dependencies>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <testFailureIgnore>false</testFailureIgnore>
-<excludes>
-<exclude>**/*AjcTestSpecAsTest*</exclude>
-</excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
-</build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testFailureIgnore>false</testFailureIgnore>
+ <argLine>${jvm.arg.addOpens}</argLine>
+ <excludes>
+ <exclude>**/*AjcTestSpecAsTest*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
import org.apache.tools.ant.types.Path;
import org.aspectj.tools.ajc.AjcTestCase;
+import static org.aspectj.util.LangUtil.is16VMOrGreater;
+
/**
* Element that allow to run an abritrary Ant target in a sandbox.
* <p/>
- * Such a spec is used in a "<ajc-test><ant file="myAnt.xml" [target="..."] [verbose="true"]/> XML element. The "target" is
- * optional. If not set, default myAnt.xml target is used. The "file" file is looked up from the <ajc-test dir="..."/> attribute. If
- * "verbose" is set to "true", the ant -v output is piped, else nothing is reported except errors.
+ * Such a spec is used in a {@code <ajc-test><ant file="myAnt.xml" [target="..."] [verbose="true"]/>} XML element. The
+ * {@code target} is optional. If not set, default <i>myAnt.xml</i> target is used. The {@code file} is looked up from
+ * the {@code <ajc-test dir="..."/>} attribute. If @{code verbose} is set to {@code true}, the {@code ant -v} output is
+ * piped, else nothing is reported except errors.
* <p/>
- * The called Ant target benefits from 2 implicit variables: "${aj.sandbox}" points to the test current sandbox folder. "aj.path" is
- * an Ant refid on the classpath formed with the sandbox folder + ltw + the AjcTestCase classpath (ie usually aspectjrt, junit, and
- * testing infra)
+ * The called Ant target benefits from some implicit variables:
+ * <ul>
+ * <li>{@code ${aj.sandbox}} points to the test current sandbox folder.</li>
+ * <li>
+ * {@code ${aj.path}} is an Ant refid on the classpath formed with the sandbox folder + ltw + the AjcTestCase
+ * classpath (i.e. usually aspectjrt, junit, and testing infra).
+ * </li>
+ * <li>
+ * For Java 16+, {@code ${aj.addOpensKey}} and {@code ${aj.addOpensValue}} together add {@code --add-opens} and
+ * {@code java.base/java.lang=ALL-UNNAMED} as JVM parameters. They have to be used together and consecutively in
+ * this order as {@code jvmarg} parameter tags inside the {@code java} Ant task.
+ * </li>
+ * </ul>
* <p/>
- * Element "<stdout><line text="..">" and "<stderr><line text="..">" can be used. For now a full match is performed on the output of
- * the runned target only (not the whole Ant invocation). This is experimental and advised to use a "<junit>" task instead or a
- * "<java>" whose main that throws some exception upon failure.
- *
+ * Element {@code <stdout><line text="..">} and {@code <stderr><line text="..">} can be used. For now, a full match is
+ * performed on the output of the runned target only (not the whole Ant invocation). This is experimental and you are
+ * advised to use a {@code <junit>} task instead or a {@code <java>} whose main throws some exception upon failure.
*
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
// setup aj.dir "modules" folder
p.setUserProperty("aj.root", new File("..").getAbsolutePath());
+ // On Java 16+, LTW no longer works without this parameter. Add the argument here and not in AjcTestCase::run,
+ // because even if 'useLTW' and 'useFullLTW' are not set, we might in the future have tests for weaver attachment
+ // during runtime. See also docs/dist/doc/README-187.html.
+ //
+ // Attention: Ant 1.6.3 under Linux neither likes "" (empty string) nor " " (space), on Windows it would not be
+ // a problem. So we use "_dummy" Java system properties, even though they pollute the command line.
+ p.setUserProperty("aj.addOpensKey", is16VMOrGreater() ? "--add-opens" : "-D_dummy");
+ p.setUserProperty("aj.addOpensValue", is16VMOrGreater() ? "java.base/java.lang=ALL-UNNAMED" : "-D_dummy");
+
// create the test implicit path aj.path that contains the sandbox + regular test infra path
Path path = new Path(p, inTestCase.getSandboxDirectory().getAbsolutePath());
populatePath(path, DEFAULT_LTW_CLASSPATH_ENTRIES);
import org.aspectj.tools.ajc.AjcTestCase;
import org.aspectj.util.FileUtil;
+import static org.aspectj.util.LangUtil.is16VMOrGreater;
+
/**
* @author Adrian Colyer
*/
try {
setSystemProperty("test.base.dir", inTestCase.getSandboxDirectory().getAbsolutePath());
+ if (vmargs == null)
+ vmargs = "";
+ // On Java 16+, LTW no longer works without this parameter. Add the argument here and not in AjcTestCase::run,
+ // because even if 'useLTW' and 'useFullLTW' are not set, we might in the future have tests for weaver attachment
+ // during runtime. See also docs/dist/doc/README-187.html.
+ vmargs += is16VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : "";
+
AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw));
if (stdErrSpec != null) {
<jvmarg value="-Dorg.aspectj.weaver.Dump.condition=error"/>
<sysproperty key="org.aspectj.dump.directory" path="${aj.sandbox}"/>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<!-- <jvmarg line="${jdwp}"/>-->
-<!--
+<!--
<jvmarg value="-Dorg.aspectj.tracing.enabled=true"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
--->
+-->
</java>
</target>
<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>
<jvmarg value="-Dorg.aspectj.tracing.enabled=true"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
<!-- 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 line="${jdwp}"/>-->
</java>
</target>
<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 line="${jdwp}"/> -->
</java>
</target>
<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 line="${jdwp}"/>--><!-- uncomment to debug with JDWP -->
</java>
</target>
<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}"/>
</java>
</target>
<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}"/>
</java>
</target>
<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}"/>
</java>
</target>
<pathelement path="${aj.sandbox}/main1.jar"/>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
</java>
</target>
</javac>
<copy file="ataspectj/ltwlog/aop-silent.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"
- overwrite="yes"
+ overwrite="yes"
/>
<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}"/>
</java>
<copy file="ataspectj/ltwlog/aop-verbsoe.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"
- overwrite="yes"
+ overwrite="yes"
/>
<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}"/>
</java>
<copy file="ataspectj/ltwlog/aop-verboseandshow.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"
- overwrite="yes"
+ overwrite="yes"
/>
<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}"/>
</java>
</target>
<pathelement path="${aj.root}/lib/asm/asm-2.0.jar"/>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
</java>
</target>
<target name="ltw.Decp">
<copy file="ataspectj/aop-decptest.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"
- overwrite="yes"
+ overwrite="yes"
/>
<java fork="yes" classname="ataspectj.DeclareParentsInterfaceTest" failonerror="yes">
<classpath>
<path refid="aj.path"/>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
</java>
<copy file="ataspectj/aop-decptest.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"
- overwrite="yes"
+ overwrite="yes"
/>
<java fork="yes" classname="ataspectj.DeclareParentsImplementsTest" failonerror="yes">
<classpath>
<path refid="aj.path"/>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
</java>
</target>
<path refid="aj.path"/>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
</java>
</target>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-DaspectDeclared=true"/>
+ <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"
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-DaspectDeclared=false"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
</java>
</target>
<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}"/>
</java>
</target>
<pathelement path="${aj.sandbox}/aspects.jar"/>
</classpath>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
-<!--
--->
<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 line="${jdwp}"/>-->
</java>
</target>
-</project>
\ No newline at end of file
+</project>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
- <sysproperty key="org.aspectj.dump.directory" path="${aj.sandbox}"/>
-<!-- <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
- <arg path="${aj.sandbox}"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
+ <!--<jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
+ <sysproperty key="org.aspectj.dump.directory" path="${aj.sandbox}"/>
+ <arg path="${aj.sandbox}"/>
</java>
</target>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
- <sysproperty key="org.aspectj.dump.directory" path="${aj.sandbox}"/>
-<!-- <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
- <arg path="${aj.sandbox}"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
+ <!--<jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
+ <sysproperty key="org.aspectj.dump.directory" path="${aj.sandbox}"/>
+ <arg path="${aj.sandbox}"/>
</java>
</target>
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
<classpath refid="aj.path"/>
<jvmarg value="-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
- <sysproperty key="aj.class.path" path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar"/>
-<!--
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
+ <jvmarg value="-Dorg.aspectj.tracing.debug=true"/>
+<!--
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
--->
- <jvmarg value="-Dorg.aspectj.tracing.debug=true"/>
+-->
<!-- use META-INF/aop.xml style -->
-<!-- <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>-->
-<!-- <jvmarg line="${jdwp}"/>-->
+ <!--<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>-->
+ <!--<jvmarg line="${jdwp}"/>-->
+ <sysproperty key="aj.class.path" path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar"/>
</java>
</target>
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
<classpath refid="aj.path"/>
<jvmarg value="-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
- <sysproperty key="aj.class.path" path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar"/>
- <sysproperty key="aj.aspect.path" path="${aj.sandbox}/handler.jar"/>
-<!--
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
+ <jvmarg value="-Dorg.aspectj.tracing.debug=true"/>
+<!--
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
--->
- <jvmarg value="-Dorg.aspectj.tracing.debug=true"/>
+-->
<!-- use META-INF/aop.xml style -->
-<!-- <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>-->
-<!-- <jvmarg line="${jdwp}"/>-->
+ <!--<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>-->
+ <!--<jvmarg line="${jdwp}"/>-->
+ <sysproperty key="aj.class.path" path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar"/>
+ <sysproperty key="aj.aspect.path" path="${aj.sandbox}/handler.jar"/>
</java>
</target>
<!-- We have three JARs files, two containing aspects (ExceptionHandler and Tracing)
for which aop-ajc.xml files have been generate. However we supply our own
- aop.xml which declares only ExceptionHandler. We then override the
+ aop.xml which declares only ExceptionHandler. We then override the
configuration search path -->
<target name="override default path using -Dorg.aspectj.weaver.loadtime.configuration">
<copy file="${aj.root}/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml"
<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 line="${jdwp}"/>-->
</java>
</target>
- <!-- Beware, this is complicated! We need to intercept class loading on
+ <!-- Beware, this is complicated! We need to intercept class loading on
the System class loader before any classes are loaded. We do this
by replacing the URLClassLoader. We then define a custom
SecurityManager that will be loaded _before_ the class loader
hierarch is fully initialized. -->
<target name="NPE with custom agent">
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
-
+
<!-- Prepend custom URLClassLoader and append AspectJ
to bootclasspath -->
<jvmarg value="-Xbootclasspath/p:${aj.sandbox}"/>
<jvmarg value="-Xbootclasspath/a:${aj.bootpath}"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<classpath>
<pathelement path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar:${aj.sandbox}/security.jar"/>
<!-- Specify custom SecurityManager that will be loaded
and woven very early -->
<jvmarg value="-Djava.security.manager=NullSecurityManager"/>
-
+
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
-
-<!--
+
+<!--
<jvmarg value="-Dorg.aspectj.tracing.enabled=true"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
--->
+-->
</java>
</target>
<classpath refid="aj.path"/>
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
<sysproperty key="org.aspectj.dump.directory" path="${aj.sandbox}"/>
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
-<!-- <jvmarg line="${jdwp}"/>-->
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
+<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
<build>
- <pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.self="override">
<testFailureIgnore>false</testFailureIgnore>
+ <argLine>${jvm.arg.addOpens}</argLine>
<includes>
<include>**/TestsModuleTests*</include>
</includes>
</configuration>
</plugin>
</plugins>
- </pluginManagement>
</build>
</project>
<!--
Copyright 2006 contributors.
-
- All rights reserved.
- This program and the accompanying materials are made available
- under the terms of the Eclipse Public License v1.0
- which accompanies this distribution and is available at
- http://eclipse.org/legal/epl-v10.html
+
+ All rights reserved.
+ This program and the accompanying materials are made available
+ under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution and is available at
+ http://eclipse.org/legal/epl-v10.html
Contributors: Adrian Colyer
-->
<!-- project.properties contains your local settings, not checked into CVS -->
<property file="project.properties"/>
-
+
<!-- default property settings, version controlled -->
<property file="build.properties"/>
<!-- pull in the ant file defining the paths etc. for the target application -->
<import file="${target.application.definitions.file}"/>
- <!-- list of useful targets... -->
+ <!-- list of useful targets... -->
<target name="usage">
<echo message="ant build script for profiling AspectJ compiler"/>
<echo message="useful targets are:"/>
<echo message="for available customisations)"/>
</target>
- <!-- handy suites -->
+ <!-- handy suites -->
<target name="gc.suite" depends="source.compile.gc,binary.weave.gc,loadtime.weave.gc,ajdt.compile.gc"/>
<target name="full.profile.suite" depends="source.compile,binary.weave,loadtime.weave,ajdt.compile"/>
-
- <!--
+
+ <!--
how to obtain the aspectj compiler - if the use.aspectjtools.jar property
- is set to true, will use the version of aspectjtools.jar in
+ is set to true, will use the version of aspectjtools.jar in
aspectj.lib.dir. If use.aspectjtools.jar property is false, will use
the bin directories from the projects in your aspectj.workspace.root.
-->
<condition property="ajtools.jar">
<istrue value="${use.aspectjtools.jar}"/>
</condition>
-
+
<condition property="iajc.local">
<istrue value="${use.local.iajc.task.class}"/>
</condition>
-
+
<path id="aspectj.compiler.path">
<dirset dir=".">
- <include name="classes" if="iajc.local"/>
+ <include name="classes" if="iajc.local"/>
</dirset>
<fileset dir="${aspectj.lib.dir}">
<include name="aspectjtools.jar" if="ajtools.jar"/>
<include name="test*/bin"/>
</dirset>
</path>
-
+
<!-- define the iajc task -->
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
<classpath>
<target name="check.iajc.ajtools" unless="iajc.local">
<echo message="using version of iajc from aspectjtools.jar"/>
</target>
-
+
<!-- init and clean... -->
-
+
<target name="init">
- <mkdir dir="${results.dir}"/>
- <mkdir dir="${results.dir}/${target.application.name}"/>
- <mkdir dir="${results.dir}/ltw-app"/>
- <mkdir dir="${results.dir}/ltw-app/META-INF"/>
+ <mkdir dir="${results.dir}"/>
+ <mkdir dir="${results.dir}/${target.application.name}"/>
+ <mkdir dir="${results.dir}/ltw-app"/>
+ <mkdir dir="${results.dir}/ltw-app/META-INF"/>
</target>
-
+
<target name="clean" depends="init">
<delete dir="${results.dir}"/>
</target>
<!-- classpath to use for all targets -->
-
+
<path id="iajc.class.path">
<path refid="build.class.path"/>
<pathelement location="${aspectj.lib.dir}/aspectjrt.jar"/>
<path refid="aspectj.compiler.path"/>
- </path>
-
-
+ </path>
+
+
<!-- source compilation (ajc style) with various profiling -->
-
+
<target name="source.compile" depends="init,config-check">
- <iajc destdir="${results.dir}/${target.application.name}/classes"
+ <iajc destdir="${results.dir}/${target.application.name}/classes"
fork="true" maxmem="${ajc.maxmem}"
debug="on"
source="${source.level}" target="${target.level}"
<jvmarg value="${hprof.args}"/>
<jvmarg value="${gc.args}"/>
</iajc>
-
+
<tstamp>
<format property="ajc.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
</tstamp>
<property name="ajc.hprof.out" value="${results.dir}/${target.application.name}/ajc.java.hprof.${ajc.runtime}.txt"/>
<property name="ajc.gc.out" value="${results.dir}/${target.application.name}/ajc.gc.${ajc.runtime}.txt"/>
- <move file="java.hprof.txt" tofile="${ajc.hprof.out}"/>
+ <move file="java.hprof.txt" tofile="${ajc.hprof.out}"/>
<move file="gc.txt" tofile="${ajc.gc.out}"/>
<echo message="hprof data written to ${ajc.hprof.out}"/>
<echo message="gc data written to ${ajc.gc.out}"/>
- <echo message="analyse with e.g. HATS and JTune"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
</target>
<target name="source.compile.gc" depends="init,config-check">
<format property="ajc.starttime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="ajc compile started at: ${ajc.starttime}"/>
-
- <iajc destdir="${results.dir}/${target.application.name}/classes"
+
+ <iajc destdir="${results.dir}/${target.application.name}/classes"
fork="true" maxmem="${ajc.maxmem}"
debug="on"
source="${source.level}" target="${target.level}"
time="true">
<jvmarg value="${gc.args}"/>
</iajc>
-
+
<tstamp>
<format property="ajc.endtime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="gc data written to ${ajc.gc.only.out}"/>
<echo message="analyze with JTune"/>
</target>
-
+
<!-- binary weaving with various profiling options -->
-
- <!-- build an aspect library to use for binary weaving, so that we
+
+ <!-- build an aspect library to use for binary weaving, so that we
profile weaving only... -->
<target name="aspectlib" depends="init">
<iajc outjar="${results.dir}/aspectlib.jar"
classpathref="iajc.class.path">
</iajc>
</target>
-
+
<target name="binary.weave" depends="init,aspectlib">
<iajc outjar="${results.dir}/woven.jar"
debug="on"
<jvmarg value="${hprof.args}"/>
<jvmarg value="${gc.args}"/>
</iajc>
-
+
<tstamp>
<format property="bw.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
</tstamp>
<property name="bw.hprof.out" value="${results.dir}/${target.application.name}/weave.java.hprof.${bw.runtime}.txt"/>
<property name="bw.gc.out" value="${results.dir}/${target.application.name}/weave.gc.${bw.runtime}.txt"/>
- <move file="java.hprof.txt" tofile="${bw.hprof.out}"/>
+ <move file="java.hprof.txt" tofile="${bw.hprof.out}"/>
<move file="gc.txt" tofile="${bw.gc.out}"/>
<echo message="hprof data written to ${bw.hprof.out}"/>
<echo message="gc data written to ${bw.gc.out}"/>
- <echo message="analyse with e.g. HATS and JTune"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
</target>
<target name="binary.weave.gc" depends="init,aspectlib">
<format property="bw.starttime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="weave started at: ${bw.starttime}"/>
-
+
<iajc outjar="${results.dir}/woven.jar"
debug="on"
source="${source.level}"
</aspectpath>
<jvmarg value="${gc.args}"/>
</iajc>
-
+
<tstamp>
<format property="bw.endtime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="gc data written to ${bw.gc.only.out}"/>
<echo message="analyze with JTune"/>
</target>
-
+
<!-- loadtime weaving with various profiling options -->
-
+
<target name="ltw-app" depends="init"
description="builds an application that we can run with ltw. The app does
Class.forName(..) on every type within the jar file passed to
it as an argument, thus forcing all those types (and types they
reference) to be woven)">
- <javac srcdir="ltw-app/src" destdir="${results.dir}/ltw-app">
+ <javac srcdir="ltw-app/src" destdir="${results.dir}/ltw-app">
</javac>
- <copy file="${ltw.aop.xml}" todir="${results.dir}/ltw-app/META-INF"/>
+ <copy file="${ltw.aop.xml}" todir="${results.dir}/ltw-app/META-INF"/>
</target>
-
+
<target name="check-using-jars" unless="ajtools.jar">
<echo message="WARNING: cannot run load-time weaving from workspace dirs"/>
<echo message="use.aspectjtools.jar setting will be ignored and the jar"/>
- <echo message="${aspectj.lib.dir}/aspectjweaver.jar will be used for LTW instead"/>
+ <echo message="${aspectj.lib.dir}/aspectjweaver.jar will be used for LTW instead"/>
</target>
-
+
<target name="loadtime.weave" depends="check-using-jars,aspectlib,ltw-app">
<java classname="org.aspectj.profiling.LTWApp"
fork="true"
<jvmarg value="${gc.args}"/>
<jvmarg value="${hprof.args}"/>
<jvmarg value="-javaagent:${aspectj.lib.dir}/aspectjweaver.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<classpath>
<pathelement location="${results.dir}/ltw-app"/>
<pathelement location="${results.dir}/aspectlib.jar"/>
<path refid="iajc.class.path"/>
</classpath>
</java>
- <tstamp>
+ <tstamp>
<format property="ltw.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
</tstamp>
<property name="ltw.hprof.out" value="${results.dir}/${target.application.name}/ltw.java.hprof.${ltw.runtime}.txt"/>
<property name="ltw.gc.out" value="${results.dir}/${target.application.name}/ltw.gc.${ltw.runtime}.txt"/>
- <move file="java.hprof.txt" tofile="${ltw.hprof.out}"/>
+ <move file="java.hprof.txt" tofile="${ltw.hprof.out}"/>
<move file="gc.txt" tofile="${ltw.gc.out}"/>
<echo message="hprof data written to ${ltw.hprof.out}"/>
<echo message="gc data written to ${ltw.gc.out}"/>
- <echo message="analyse with e.g. HATS and JTune"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
</target>
-
+
<target name="loadtime.weave.gc" depends="check-using-jars,aspectlib,ltw-app">
<tstamp>
<format property="ltw.starttime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="ltw started at: ${ltw.starttime}"/>
-
+
<java classname="org.aspectj.profiling.LTWApp"
fork="true"
maxmemory="${ajc.maxmem}">
<arg value="${weave.injar}"/>
<jvmarg value="${gc.args}"/>
<jvmarg value="-javaagent:${aspectj.lib.dir}/aspectjweaver.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<classpath>
<pathelement location="${results.dir}/ltw-app"/>
<pathelement location="${results.dir}/aspectlib.jar"/>
<path refid="iajc.class.path"/>
</classpath>
</java>
-
+
<tstamp>
<format property="ltw.endtime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="gc data written to ${ltw.gc.only.out}"/>
<echo message="analyze with JTune"/>
</target>
-
+
<!-- "AJDT-like" compiles with various profiling options -->
-
+
<target name="prepare-project" depends="init">
<delete dir="${results.dir}/ajdt-workspace-root"/>
<mkdir dir="${results.dir}/ajdt-workspace-root"/>
<param name="todir" value="${results.dir}/ajdt-workspace-root/${target.application.name}/base"/>
</antcall>
</target>
-
+
<target name="ajdt.compile" depends="prepare-project">
<java classname="org.aspectj.systemtest.incremental.tools.AjdeInteractionTestbedLauncher"
</classpath>
</java>
- <tstamp>
+ <tstamp>
<format property="ajdt.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
</tstamp>
<property name="ajdt.hprof.out" value="${results.dir}/${target.application.name}/ajdt.java.hprof.${ajdt.runtime}.txt"/>
<property name="ajdt.gc.out" value="${results.dir}/${target.application.name}/ajdt.gc.${ajdt.runtime}.txt"/>
- <move file="java.hprof.txt" tofile="${ajdt.hprof.out}"/>
+ <move file="java.hprof.txt" tofile="${ajdt.hprof.out}"/>
<move file="gc.txt" tofile="${ajdt.gc.out}"/>
<echo message="hprof data written to ${ajdt.hprof.out}"/>
<echo message="gc data written to ${ajdt.gc.out}"/>
- <echo message="analyse with e.g. HATS and JTune"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
</target>
<format property="ajdt.starttime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="AJDT started at: ${ajdt.starttime}"/>
-
+
<java classname="org.aspectj.systemtest.incremental.tools.AjdeInteractionTestbedLauncher"
fork="true"
maxmemory="${ajc.maxmem}">
<pathelement location="${aspectj.lib.dir}/aspectjrt.jar"/>
</classpath>
</java>
-
+
<tstamp>
<format property="ajdt.endtime" pattern="HH:mm:ss"/>
</tstamp>
<echo message="gc data written to ${ajdt.gc.only.out}"/>
<echo message="analyze with JTune"/>
</target>
-
-</project>
\ No newline at end of file
+
+</project>
*******************************************************************************/
package org.aspectj.systemtest.ajc167;
-import org.aspectj.testing.XMLBasedAjcTestCase;
-
import junit.framework.Test;
+import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc167Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("optimizing string anno value binding");
}
+ // FIXME: This test is flaky - can depend on machine load
public void testOptimizingAnnotationBinding() {
runTest("optimizing annotation binding");
}
- // bit flakey - can depend on machine load
- // public void testOptimizingAnnotationBindingPerfTest() {
- // runTest("optimizing annotation binding - 2");
- // }
+ // FIXME: This test is flaky - can depend on machine load
+/*
+ public void testOptimizingAnnotationBindingPerfTest() {
+ runTest("optimizing annotation binding - 2");
+ }
+*/
/*
* public void testPerThisLTW_295092() { runTest("perthis ltw"); }
return getClassResource("ajc167.xml");
}
-}
\ No newline at end of file
+}
<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 line="${jdwp}"/>-->
</java>
</target>
<!-- <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 line="${jdwp}"/>-->
</java>
</target>
<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 line="${jdwp}"/>-->
</java>
</target>
<jvmarg value="-Dorg.aspectj.tracing.enabled=true"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
- <sysproperty key="org.aspectj.tracing.file" path="${aj.sandbox}/tracing.txt"/>
+ <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="${aj.addOpensKey}"/>
+ <jvmarg value="${aj.addOpensValue}"/>
<!-- <jvmarg value="-verbose:class"/>-->
<!-- use META-INF/aop.xml style -->
- <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<!-- <jvmarg line="${jdwp}"/>-->
+ <sysproperty key="org.aspectj.tracing.file" path="${aj.sandbox}/tracing.txt"/>
</java>
</target>