diff options
81 files changed, 1638 insertions, 395 deletions
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b8fbbf386..c1bf1b3bf 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: # Check for available Temurin releases on https://adoptium.net/releases.html - java: [ 11, 17, 18 ] + java: [ 11, 17, 19 ] runs-on: ubuntu-latest diff --git a/ajde.core/pom.xml b/ajde.core/pom.xml index eefb3a411..9de1dd313 100644 --- a/ajde.core/pom.xml +++ b/ajde.core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>ajde.core</artifactId> diff --git a/ajde/pom.xml b/ajde/pom.xml index 51679ae2d..948492f96 100644 --- a/ajde/pom.xml +++ b/ajde/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>ajde</artifactId> diff --git a/ajdoc/pom.xml b/ajdoc/pom.xml index 50922a65c..9ab6304df 100644 --- a/ajdoc/pom.xml +++ b/ajdoc/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>ajdoc</artifactId> diff --git a/asm/pom.xml b/asm/pom.xml index ff1bdc1ed..02229d0d0 100644 --- a/asm/pom.xml +++ b/asm/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>asm</artifactId> diff --git a/aspectjmatcher/pom.xml b/aspectjmatcher/pom.xml index f707b22e6..9f664c0bd 100644 --- a/aspectjmatcher/pom.xml +++ b/aspectjmatcher/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>aspectjmatcher</artifactId> diff --git a/aspectjrt/pom.xml b/aspectjrt/pom.xml index 22a47dd29..09e67eef0 100644 --- a/aspectjrt/pom.xml +++ b/aspectjrt/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>aspectjrt</artifactId> diff --git a/aspectjtools/pom.xml b/aspectjtools/pom.xml index 3c6f708d3..eb9300e31 100644 --- a/aspectjtools/pom.xml +++ b/aspectjtools/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>aspectjtools</artifactId> diff --git a/aspectjweaver/pom.xml b/aspectjweaver/pom.xml index a173b769c..09dfb01a9 100644 --- a/aspectjweaver/pom.xml +++ b/aspectjweaver/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>aspectjweaver</artifactId> diff --git a/bcel-builder/pom.xml b/bcel-builder/pom.xml index f2f8ca305..d8eb96943 100644 --- a/bcel-builder/pom.xml +++ b/bcel-builder/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>bcel-builder</artifactId> diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java index 6c2240b9d..87c36f2ff 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java @@ -100,8 +100,10 @@ public interface Constants { short MINOR_17 = 0; short MAJOR_18 = 62; short MINOR_18 = 0; -// short MAJOR_19 = 63; -// short MINOR_19 = 0; + short MAJOR_19 = 63; + short MINOR_19 = 0; +// short MAJOR_20 = 64; +// short MINOR_20 = 0; int PREVIEW_MINOR_VERSION = 65535; diff --git a/bridge/pom.xml b/bridge/pom.xml index 20411313c..fcbc63e00 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>bridge</artifactId> diff --git a/build/pom.xml b/build/pom.xml index 23ae6dd97..cb2fb7456 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>build</artifactId> diff --git a/docs/dist/doc/README-1919.html b/docs/dist/doc/README-1919.html new file mode 100644 index 000000000..a146c53a7 --- /dev/null +++ b/docs/dist/doc/README-1919.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> + +<head> +<title>AspectJ 1.9.19 Readme</title> +<style type="text/css"> + <!-- + P { margin-left: 20px; } + PRE { margin-left: 20px; } + LI { margin-left: 20px; } + H4 { margin-left: 20px; } + H3 { margin-left: 10px; } + --> +</style> +</head> + +<body> +<div align="right"><small>© Copyright 2022 Contributors. All rights reserved.</small></div> + +<h1>AspectJ 1.9.19</h1> + +<p> + Please note that Bugzilla for issue management is deprecated and new issues should be filed as + <a href="https://github.com/eclipse/org.aspectj/issues/new">GitHub issues</a>. + The list of issues addressed for 1.9.19 can be found here: + <ul> + <li><a href="https://github.com/eclipse/org.aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.19">GitHub 1.9.19</a></li> + <li><a href="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.19">Bugzilla 1.9.19</a></li> + </ul> +</p> + +<h2>New features</h2> + +<p> + AspectJ 1.9.19 supports <a href="https://openjdk.java.net/projects/jdk/19/">Java 19</a> and its final, preview and + incubator features, such as: +</p> +<ul> + <li>Record patterns (preview)</li> + <li>Virtual threads (preview)</li> + <li>Pattern matching for <tt>switch</tt> (preview 3)</li> + <li>Structured concurrency (incubator)</li> +</ul> + +Please note that the upstream Eclipse Java Compiler (ECJ) which the AspectJ Compiler (AJC) is a fork of still has some +open issues concerning Java 19 preview feature support, see the list in +<a href="https://github.com/eclipse/org.aspectj/issues/184#issuecomment-1272254940">this comment</a>. AJC therefore +inherits the same problems for the specific cases described in the linked issues. + +<h2>Improvements</h2> + +<p> + In annotation style aspects, asynchronous <tt>proceed()</tt> calls in <tt>@Around</tt> advice now works in threads + created from within the advice. Previously, this was only working in native syntax aspects. There is still a + limitation with regard to asynchronous proceed, if you do not create the thread in the advice but want to use e.g. + an <tt>ExecutorService</tt> with its own thread pool. This still is not working in annotation style aspects, only in + native syntax ones. +</p> +<p> + See <a href="https://github.com/eclipse/org.aspectj/issues/128">issue #128</a> and + <a href="https://github.com/eclipse/org.aspectj/pull/132">pull request #132</a> for more details. +</p> +<h2>Code examples</h2> + +<p> + You can find some sample code in the AspectJ test suite under the respective AspectJ version in which the features + were first supported (possibly as JVM preview features): +</p> +<ul> + <li> + <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/features198/java17"> + Pattern matching for switch (preview 1) + </a> + </li> + <li> + <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/features199/java18"> + Pattern matching for switch (preview 2) + </a> + </li> + <li> + <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/features199/java18"> + Pattern matching for switch (preview 3), record patterns (preview 1) + </a> + </li> + <li> + <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/bugs199/github_128"> + Asynchronous proceed in native vs. annotation style syntax + </a> + </li> + <li> + Please note that presently there is no specific sample code for virtual threads and structured concurrency in the + AspectJ code base, because these are just new APIs, no Java language features. You can find sample code for these + concurrency features elsewhere, e.g. in the corresponding JEPs. In AspectJ, they should just work transparently + like any other Java API. + </li> +</ul> + +<h2>Other changes and bug fixes</h2> + +<ul> + <li> + Fix a bug which led to <tt>NullPointerException</tt>s if too many JAR archives were on the classpath. Too many here + means the value system property <tt>org.aspectj.weaver.openarchives</tt> (1,000 by default). The AspectJ compiler is + meant to close archives upon cache exhaustion and then re-open them if it needs them again later. Re-opening was + broken, now the compiler works reliably even for cache sizes as small as 20. See issue + <a href="https://github.com/eclipse/org.aspectj/issues/125">#125</a>. + </li> + <li> + Improvements for <tt>if()</tt> pointcuts in annotation syntax, see issues + <a href="https://github.com/eclipse/org.aspectj/issues/115">#115</a>, + <a href="https://github.com/eclipse/org.aspectj/issues/120">#120</a>, + <a href="https://github.com/eclipse/org.aspectj/issues/122">#122</a>. + </li> + <li> + Thanks to Andrey Turbanov for several clean code contributions. + </li> +</ul> + +<h2>AspectJ usage hints</h2> + +<h3>AspectJ compiler build system requirements</h3> + +<p> + Since 1.9.7, the AspectJ compiler <tt>ajc</tt> (contained in the <tt>aspectjtools</tt> library) no longer works on + JDKs 8 to 10. The minimum compile-time requirement is now JDK 11 due to upstream changes in the Eclipse Java Compiler + (subset of JDT Core), which AspectJ is a fork of. You can still compile to legacy target versions as low as Java 1.3 + when compiling plain Java code or using plain Java ITD constructs which do not require the AspectJ runtime + <tt>aspectjrt</tt>, but the compiler itself needs JDK 11+. Just like in previous AspectJ versions, both the runtime + <tt>aspectjrt</tt> and the load-time weaver <tt>aspectjweaver</tt> still only require JRE 8+. +</p> + +<h3>Use LTW on Java 16+</h3> + +<p> + Please note that if you want to use load-time weaving on Java 16+, the weaving agent collides with + <a href="https://openjdk.java.net/jeps/396">JEP 396 (Strongly Encapsulate JDK Internals by Default)</a> and related + subsequent JEPs. Therefore, you need to set the JVM parameter <tt>--add-opens java.base/java.lang=ALL-UNNAMED</tt> in + order to enable aspect weaving. This is due to the fact that the weaver uses internal APIs for which we have not found + an adequate replacement yet when defining classes in different classloaders. +</p> + +<h3>Compile with Java preview features</h3> + +<p> + For features marked as preview on a given JDK, you need to compile with <tt>ajc --enable-preview</tt> and run with + <tt>java --enable-preview</tt> on that JDK. +</p> +<p> + Please note that you cannot run code compiled with preview features on any other JDK than the one used for + compilation. For example, records compiled with preview on JDK 15 cannot be used on JDK 16 without recompilation. This + is a JVM limitation unrelated to AspectJ. Also, e.g. sealed classes are preview-1 on JDK 15 and preview-2 on JDK 16. + You still need to recompile, no matter what. +</p> + +<hr> + +<p> + <b>Available:</b> 1.9.19 on DD-MMM-2022 +</p> + +</body> + +</html> diff --git a/docs/dist/doc/index.html b/docs/dist/doc/index.html index 371961da2..84d4f79ad 100644 --- a/docs/dist/doc/index.html +++ b/docs/dist/doc/index.html @@ -136,6 +136,8 @@ <tr> <td>README's </td> <td>Changes and porting guide for AspectJ + <a href="README-1919.html">1.9.19</a>, + <a href="README-199.html">1.9.9 and 1.9.9.1</a>, <a href="README-198.html">1.9.8</a>, <a href="README-197.html">1.9.7</a>, <a href="README-196.html">1.9.6</a>, diff --git a/docs/pom.xml b/docs/pom.xml index 39a7c0f7f..30c0c2f68 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>docs</artifactId> diff --git a/installer/pom.xml b/installer/pom.xml index 499c48f16..a9474926c 100644 --- a/installer/pom.xml +++ b/installer/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>installer</artifactId> diff --git a/lib/pom.xml b/lib/pom.xml index 712df9905..eb26770db 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>lib</artifactId> diff --git a/loadtime/pom.xml b/loadtime/pom.xml index c940bab30..0a759d23b 100644 --- a/loadtime/pom.xml +++ b/loadtime/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>loadtime</artifactId> diff --git a/org.aspectj.ajdt.core/pom.xml b/org.aspectj.ajdt.core/pom.xml index 37b5fb181..b3a358989 100644 --- a/org.aspectj.ajdt.core/pom.xml +++ b/org.aspectj.ajdt.core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>org.aspectj.ajdt.core</artifactId> diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildNotifier.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildNotifier.java index 1a82cb6a0..53fb5750c 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildNotifier.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildNotifier.java @@ -11,10 +11,11 @@ package org.aspectj.ajdt.internal.core.builder; import org.aspectj.bridge.IProgressListener; -import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IProgressMonitor; import org.aspectj.org.eclipse.jdt.internal.core.builder.BuildNotifier; +import java.util.function.BooleanSupplier; + /** * @author colyer * @@ -26,8 +27,8 @@ public class AjBuildNotifier extends BuildNotifier implements IProgressListener * @param monitor * @param project */ - public AjBuildNotifier(IProgressMonitor monitor, IProject project) { - super(monitor, project); + public AjBuildNotifier(IProgressMonitor monitor, int buildKind, BooleanSupplier interruptSupplier) { + super(monitor, buildKind, interruptSupplier); } /* (non-Javadoc) diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java index 6435903c8..f352a7690 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java @@ -16,6 +16,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Properties; +import java.util.function.BooleanSupplier; import org.aspectj.ajdt.core.AspectJCore; import org.aspectj.ajdt.internal.compiler.CompilerAdapter; @@ -149,8 +150,8 @@ public class AspectJBuilder extends JavaBuilder implements ICompilerAdapterFacto * @see org.eclipse.jdt.internal.core.builder.JavaBuilder#createBuildNotifier(org.eclipse.core.runtime.IProgressMonitor, * org.eclipse.core.resources.IProject) */ - protected BuildNotifier createBuildNotifier(IProgressMonitor monitor, IProject currentProject) { - return new AjBuildNotifier(monitor, currentProject); + protected BuildNotifier createBuildNotifier(IProgressMonitor monitor, int buildKind, BooleanSupplier interruptSupplier) { + return new AjBuildNotifier(monitor, buildKind, interruptSupplier); } private void initWorldAndWeaver(AjCompilerOptions options) { diff --git a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties index 23bd98c02..d837c76dc 100644 --- a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties +++ b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties @@ -1,5 +1,5 @@ compiler.name = AspectJ Compiler -compiler.version = Eclipse Compiler d3a80f1f9b2f8a (21Mar2022) - Java18 +compiler.version = Eclipse Compiler 19f448f47c9e3e (15Dec2022) - Java19 compiler.copyright = misc.version = {0} {1} - {2} {3} diff --git a/org.aspectj.matcher/pom.xml b/org.aspectj.matcher/pom.xml index bc4ac7896..1af71688b 100644 --- a/org.aspectj.matcher/pom.xml +++ b/org.aspectj.matcher/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>org.aspectj.matcher</artifactId> @@ -5,7 +5,7 @@ <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> <packaging>pom</packaging> <name>AspectJ Parent Project</name> @@ -21,8 +21,8 @@ <maven.javadoc.skip>true</maven.javadoc.skip> <!-- Dependency versions --> - <jdt.core.version>1.9.9.1</jdt.core.version> - <asm.version>9.2</asm.version> + <jdt.core.version>1.9.19-SNAPSHOT</jdt.core.version> + <asm.version>9.4</asm.version> <lib.ant.version>1.6.3</lib.ant.version> <lib.ant.xerces.version>2.6.2</lib.ant.xerces.version> <lib.regexp.version>1.2</lib.regexp.version> diff --git a/run-all-junit-tests/pom.xml b/run-all-junit-tests/pom.xml index 30df18d38..b636018c2 100644 --- a/run-all-junit-tests/pom.xml +++ b/run-all-junit-tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>run-all-junit-tests</artifactId> diff --git a/runtime/pom.xml b/runtime/pom.xml index e66954933..1da7e877e 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>runtime</artifactId> diff --git a/taskdefs/pom.xml b/taskdefs/pom.xml index 55f5436e0..d923446ad 100644 --- a/taskdefs/pom.xml +++ b/taskdefs/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>taskdefs</artifactId> diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java index 650fdc4e5..dc83ed7fa 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java @@ -252,15 +252,15 @@ public class AjcTask extends MatchingTask { static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", - "10", "11", "12", "13", "14", "15", "16", "17", "18" + "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" }; static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", - "10", "11", "12", "13", "14", "15", "16", "17", "18" + "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" }; static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", - "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18" + "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18", "-19" }; private static final ICommandEditor COMMAND_EDITOR; diff --git a/testing-client/pom.xml b/testing-client/pom.xml index 864dac12c..2e2ea723c 100644 --- a/testing-client/pom.xml +++ b/testing-client/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>testing-client</artifactId> diff --git a/testing-drivers/pom.xml b/testing-drivers/pom.xml index 30b75c3ca..08c7cf38d 100644 --- a/testing-drivers/pom.xml +++ b/testing-drivers/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>testing-drivers</artifactId> diff --git a/testing-util/pom.xml b/testing-util/pom.xml index a596d0c99..a0866689e 100644 --- a/testing-util/pom.xml +++ b/testing-util/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>testing-util</artifactId> diff --git a/testing/pom.xml b/testing/pom.xml index ae7fd0d9a..a1ff20056 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>testing</artifactId> diff --git a/testing/src/test/java/org/aspectj/testing/OutputSpec.java b/testing/src/test/java/org/aspectj/testing/OutputSpec.java index 5a6594756..14fc3bb62 100644 --- a/testing/src/test/java/org/aspectj/testing/OutputSpec.java +++ b/testing/src/test/java/org/aspectj/testing/OutputSpec.java @@ -17,6 +17,8 @@ import java.util.List; import org.aspectj.tools.ajc.AjcTestCase; import org.aspectj.util.LangUtil; +import static java.lang.Double.parseDouble; + public class OutputSpec { private List<String> expectedOutputLines = new ArrayList<>(); @@ -28,28 +30,31 @@ public class OutputSpec { } /** - * For a test output line that has specified a vm version, check if it matches the vm we are running on. - * vm might be "1.2,1.3,1.4,1.5" or simply "9" or it may be a version with a '+' suffix indicating that - * level or later, e.g. "9+" should be ok on Java 10 - * @return true if the current vm version matches the spec + * For a test output line that has specified list of JVM version ranges, determine whether the JVM we are running on + * matches at least one of those ranges. + * + * @param vmVersionRanges might be a single version like "9", a list of versions like "1.2,1.3,1.4,1.5", an equivalent + * range of "1.2-1.5", an open range like "-1.8", "9-" (equivalent to "9+") or a more complex list of ranges + * like "-1.6,9-11,13-14,17-" or "8,11,16+". Empty ranges like in "", " ", "8,,14", ",5", "6-," will be + * ignored. I.e., they will not yield a positive match. Bogus ranges like "9-11-14" will be ignored, too. + * + * @return true if the current vmVersionRanges version matches the spec */ - private boolean matchesThisVm(String vm) { - // vm might be 1.2, 1.3, 1.4, 1.5 or 1.9 possibly with a '+' in there - // For now assume + is attached to there only being one version, like "9+" - // System.out.println("Checking "+vm+" for "+LangUtil.getVmVersionString()); - String v = LangUtil.getVmVersionString(); - if (v.endsWith(".0")) { - v = v.substring(0,v.length()-2); - } - if (vm.contains(v)) { - return true; - } - if (vm.endsWith("+")) { - double vmVersion = LangUtil.getVmVersion(); - double vmSpecified = Double.parseDouble(vm.substring(0,vm.length()-1)); - return vmVersion >= vmSpecified; - } - return false; + private boolean matchesThisVm(String vmVersionRanges) { + double currentVmVersion = LangUtil.getVmVersion(); + return Arrays.stream(vmVersionRanges.split(",")) + .map(String::trim) + .filter(range -> !range.isEmpty()) + .map(range -> range + .replaceFirst("^([0-9.]+)$", "$1-$1") // single version 'n' to range 'n-n' + .replaceFirst("^-", "0-") // left open range '-n' to '0-n' + .replaceFirst("[+-]$", "-99999") // right open range 'n-' or 'n+' to 'n-99999' + .split("-") // range 'n-m' to array ['n', 'm'] + ) + .filter(range -> range.length == 2) + .map(range -> new double[] { parseDouble(range[0]), parseDouble(range[1]) }) + //.filter(range -> { System.out.println(range[0] + " - " +range[1]); return true; }) + .anyMatch(range -> range[0] <= currentVmVersion && range[1] >= currentVmVersion); } public void matchAgainst(String output) { diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java index ba4d00605..fade6c92f 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java @@ -1,5 +1,5 @@ /* ******************************************************************* - * Copyright (c) 2021 Contributors + * Copyright (c) 2022 Contributors * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v 2.0 @@ -20,14 +20,13 @@ public abstract class XMLBasedAjcTestCaseForJava18Only extends XMLBasedAjcTestCa @Override public void setUp() throws Exception { // Activate this block after upgrading to JDT Core Java 19 - /* throw new IllegalStateException( "These tests need a Java 18 level AspectJ compiler " + "(e.g. because they use version-specific preview features). " + "This compiler does not support preview features of a previous version anymore." ); - */ // Activate this block before upgrading to JDT Core Java 19 + /* if (!LangUtil.is18VMOrGreater() || LangUtil.is19VMOrGreater()) { throw new IllegalStateException( "These tests should be run on Java 18 only " + @@ -35,6 +34,7 @@ public abstract class XMLBasedAjcTestCaseForJava18Only extends XMLBasedAjcTestCa ); } super.setUp(); + */ } } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java index 9b9efdd34..20e26862f 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java @@ -1,5 +1,5 @@ /* ******************************************************************* - * Copyright (c) 2021 Contributors + * Copyright (c) 2022 Contributors * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v 2.0 diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java new file mode 100644 index 000000000..e0a99283d --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java @@ -0,0 +1,40 @@ +/* ******************************************************************* + * Copyright (c) 2022 Contributors + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * ******************************************************************/ +package org.aspectj.testing; + +import org.aspectj.util.LangUtil; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Alexander Kriegisch + */ +public abstract class XMLBasedAjcTestCaseForJava19Only extends XMLBasedAjcTestCase { + + @Override + public void setUp() throws Exception { + // Activate this block after upgrading to JDT Core Java 20 + /* + throw new IllegalStateException( + "These tests need a Java 19 level AspectJ compiler " + + "(e.g. because they use version-specific preview features). " + + "This compiler does not support preview features of a previous version anymore." + ); + */ + // Activate this block before upgrading to JDT Core Java 20 + if (!LangUtil.is19VMOrGreater() || LangUtil.is20VMOrGreater()) { + throw new IllegalStateException( + "These tests should be run on Java 19 only " + + "(e.g. because they use version-specific preview features)" + ); + } + super.setUp(); + } + +} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java new file mode 100644 index 000000000..95beffef5 --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java @@ -0,0 +1,27 @@ +/* ******************************************************************* + * Copyright (c) 2022 Contributors + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * ******************************************************************/ +package org.aspectj.testing; + +import org.aspectj.util.LangUtil; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Alexander Kriegisch + */ +public abstract class XMLBasedAjcTestCaseForJava19OrLater extends XMLBasedAjcTestCase { + + @Override + public void setUp() throws Exception { + if (!LangUtil.is19VMOrGreater()) + throw new IllegalStateException("These tests should be run on Java 19 or later"); + super.setUp(); + } + +} diff --git a/tests/features1919/java19/RecordPatternsPreview1Aspect.aj b/tests/features1919/java19/RecordPatternsPreview1Aspect.aj new file mode 100644 index 000000000..20f6a54e5 --- /dev/null +++ b/tests/features1919/java19/RecordPatternsPreview1Aspect.aj @@ -0,0 +1,35 @@ +public aspect RecordPatternsPreview1Aspect { + public static void main(String[] args) { + doSomething(new Point(2, 7)); + doSomething(new Rectangle( + new ColoredPoint(new Point(1, 6), Color.RED), + new ColoredPoint(new Point(4, 6), Color.BLUE) + )); + } + + public static void doSomething(Object object) { + System.out.println("Doing something with " + object); + } + + before(Object object): execution(* doSomething(*)) && args(object) { + if (object instanceof Point p) { + int x = p.x(); + int y = p.y(); + System.out.println(x + y); + } + if (object instanceof Point(int x, int y)) + System.out.println(x * y); + + if (object instanceof Rectangle(ColoredPoint ul, ColoredPoint lr)) + System.out.println("Upper-left color: " + ul.c()); + if (object instanceof Rectangle(ColoredPoint(Point p, Color c), ColoredPoint lr)) + System.out.println("Upper-left color: " + c); + if (object instanceof Rectangle(ColoredPoint(Point(var x, var y), var c), var lr)) + System.out.println("Upper-left x coordinate: " + x); + } +} + +record Point(int x,int y){} +enum Color { RED, GREEN, BLUE } +record ColoredPoint(Point p, Color c) {} +record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {} diff --git a/tests/features1919/java19/RecordPatternsPreview1Error.java b/tests/features1919/java19/RecordPatternsPreview1Error.java new file mode 100644 index 000000000..2a5038e89 --- /dev/null +++ b/tests/features1919/java19/RecordPatternsPreview1Error.java @@ -0,0 +1,24 @@ +/** + * This was not working as expected in ECJ after the initial Java 19 merge the JDT Core main line, + * see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450. + */ +public class RecordPatternsPreview1Error { + public static void main(String[] args) { + erroneousTest1(new Box<>("A")); + erroneousTest2(new Box<>("B")); + } + + static void erroneousTest1(Box<Object> bo) { + if (bo instanceof Box(var s)) { // Javac error: raw deconstruction patterns are not allowed + System.out.println("I'm a box"); + } + } + + static void erroneousTest2(Box b) { + if (b instanceof Box(var t)) { // Javac error: raw deconstruction patterns are not allowed + System.out.println("I'm a box"); + } + } +} + +record Box<T>(T t) {} diff --git a/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj new file mode 100644 index 000000000..44c7f12d0 --- /dev/null +++ b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj @@ -0,0 +1,37 @@ +public aspect RecordPatternsPreview1ExhaustivenessAspect { + static Pair<I> p2 = new Pair<>(new C(), new D()); + + public static void main(String[] args) { + doSomething(p2); + } + + public static void doSomething(Pair pair) { + System.out.println(pair.toString().replaceAll("@[0-9a-f]+", "@000")); + } + + before(Pair pair) : execution(* doSomething(Pair)) && args(pair) { + switch (pair) { + case Pair<I>(I i, C c) -> System.out.println("x"); + case Pair<I>(I i, D d) -> System.out.println("y"); + // TODO: Remove redundant default clause when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + // has been fixed. But even with the default clause, it generates wrong byte code and throws runtime error: + // NoSuchMethodError: 'I Pair.x()' + default -> System.out.println("z"); + } + + switch (pair) { + case Pair<I>(C c, I i) -> System.out.println("a"); + case Pair<I>(D d, C c) -> System.out.println("b"); + case Pair<I>(D d1, D d2) -> System.out.println("c"); + // TODO: remove redundant default clause when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + // has been fixed. But even with the default clause, it generates wrong byte code and throws runtime error: + // NoSuchMethodError: 'I Pair.x()' + default -> System.out.println("d"); + } + } +} + +sealed interface I permits C, D { } +final class C implements I { } +final class D implements I { } +record Pair<T>(T x, T y) { } diff --git a/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java new file mode 100644 index 000000000..8df079474 --- /dev/null +++ b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java @@ -0,0 +1,22 @@ +public class RecordPatternsPreview1ExhaustivenessError { + static Pair<I> p2 = new Pair<>(new C(), new D()); + + public static void main(String[] args) { + exhaustiveSwitch(); + } + + static void exhaustiveSwitch() { + switch (p2) { + case Pair<I>(C fst, D snd) -> System.out.println("a"); + case Pair<I>(D fst, C snd) -> System.out.println("b"); + case Pair<I>(I fst, C snd) -> System.out.println("c"); + } + } +} + +class A { } +class B extends A { } +sealed interface I permits C, D { } +final class C implements I { } +final class D implements I { } +record Pair<T>(T x, T y) { } diff --git a/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK1.java b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK1.java new file mode 100644 index 000000000..4153d5021 --- /dev/null +++ b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK1.java @@ -0,0 +1,28 @@ +public class RecordPatternsPreview1ExhaustivenessOK1 { + static Pair<A> p1 = new Pair<>(new A(), new B()); + static Pair<I> p2 = new Pair<>(new C(), new D()); + + public static void main(String[] args) { + exhaustiveSwitch(); + } + + static void exhaustiveSwitch() { + switch (p2) { + case Pair<I>(I i, C c) -> System.out.println("x"); + case Pair<I>(I i, D d) -> System.out.println("y"); + } + + switch (p2) { + case Pair<I>(C c, I i) -> System.out.println("a"); + case Pair<I>(D d, C c) -> System.out.println("b"); + case Pair<I>(D d1, D d2) -> System.out.println("c"); + } + } +} + +class A { } +class B extends A { } +sealed interface I permits C, D { } +final class C implements I { } +final class D implements I { } +record Pair<T>(T x, T y) { } diff --git a/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK2.java b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK2.java new file mode 100644 index 000000000..8f80aad90 --- /dev/null +++ b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK2.java @@ -0,0 +1,10 @@ +public class RecordPatternsPreview1ExhaustivenessOK2 { + public static void main(String[] args) { + Person person = new Person("Bob", 12); + switch (person) { + case Person(var name, var age) -> System.out.println(name + " " + age); + } + } +} + +record Person(String name, int age) { } diff --git a/tests/features1919/java19/RecordPatternsPreview1OK.java b/tests/features1919/java19/RecordPatternsPreview1OK.java new file mode 100644 index 000000000..ba62f79d5 --- /dev/null +++ b/tests/features1919/java19/RecordPatternsPreview1OK.java @@ -0,0 +1,15 @@ +public class RecordPatternsPreview1OK { + static void printGenericBoxString1(Box<Object> objectBox) { + if (objectBox instanceof Box<Object>(String s)) { + System.out.println(s); + } + } + + static void printGenericBoxString2(Box<String> stringBox) { + if (stringBox instanceof Box<String>(var s)) { + System.out.println(s); + } + } +} + +record Box<T>(T t) {} diff --git a/tests/features1919/java19/SwitchPatternPreview3Aspect.aj b/tests/features1919/java19/SwitchPatternPreview3Aspect.aj new file mode 100644 index 000000000..ae147dad7 --- /dev/null +++ b/tests/features1919/java19/SwitchPatternPreview3Aspect.aj @@ -0,0 +1,88 @@ +import java.util.List; +import java.util.Locale; + +aspect SwitchPatternPreview3Aspect { + Object around(Object o) : execution(* doSomethingWithObject(*)) && args(o) { + System.out.println(switch (o) { + case null -> "null"; + case Integer i -> String.format("int %d", i); + case Long l -> String.format("long %d", l); + case Double d -> String.format(Locale.ENGLISH, "double %f", d); + case String s -> String.format("String %s", s); + default -> o.toString(); + }); + return proceed(o); + } + + before(Shape s) : execution(* doSomethingWithShape(*)) && args(s) { + System.out.println(switch (s) { + case Circle c when (c.calculateArea() > 100) -> "Large circle"; + case Circle c -> "Small circle"; + default -> "Non-circle"; + }); + } + + after(S s) : execution(* doSomethingWithSealedClass(*)) && args(s) { + System.out.println(switch (s) { + case A a -> "Sealed sub-class A"; + case B b -> "Sealed sub-class B"; + case C c -> "Sealed sub-record C"; + }); + } + + Object around(Integer i): execution(* doSomethingWithInteger(*)) && args(i) { + System.out.println( + switch (i) { + case null -> "value unavailable: " + i; + case -1, 1 -> "absolute value 1: " + i; + case Integer value when value > 0 -> "positive integer: " + i; + default -> "other integer: " + i; + } + ); + return proceed(i); + } +} + +class Shape {} +class Rectangle extends Shape {} +class Circle extends Shape { + private final double radius; + public Circle(double radius) { this.radius = radius; } + double calculateArea() { return Math.PI * radius * radius; } +} + +sealed interface S permits A, B, C {} +final class A implements S {} +final class B implements S {} +record C(int i) implements S {} // Implicitly final + +class Application { + public static void main(String[] args) { + doSomethingWithObject(null); + doSomethingWithObject(123); + doSomethingWithObject(999L); + doSomethingWithObject(12.34); + doSomethingWithObject("foo"); + doSomethingWithObject(List.of(123, "foo", 999L, 12.34)); + + doSomethingWithShape(new Rectangle()); + doSomethingWithShape(new Circle(5)); + doSomethingWithShape(new Circle(6)); + + doSomethingWithSealedClass(new A()); + doSomethingWithSealedClass(new B()); + doSomethingWithSealedClass(new C(5)); + + doSomethingWithInteger(-1); + doSomethingWithInteger(0); + doSomethingWithInteger(42); + doSomethingWithInteger(-99); + doSomethingWithInteger(Integer.valueOf(123)); + doSomethingWithInteger(null); + } + + public static Object doSomethingWithObject(Object o) { return o; } + public static void doSomethingWithSealedClass(S s) {} + public static void doSomethingWithShape(Shape s) {} + public static Object doSomethingWithInteger(Integer o) { return o; } +} diff --git a/tests/features1919/java19/SwitchPatternPreview3Error1.java b/tests/features1919/java19/SwitchPatternPreview3Error1.java new file mode 100644 index 000000000..5f3895cc3 --- /dev/null +++ b/tests/features1919/java19/SwitchPatternPreview3Error1.java @@ -0,0 +1,13 @@ +/** + * Inspired by examples in https://openjdk.java.net/jeps/420 + */ +public class SwitchPatternPreview3Error1 { + static void constantLabelsMustAppearBeforePatterns1(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + case Integer value when value > 0 -> System.out.println("positive integer: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + default -> System.out.println("other integer: " + i); + } + } +} diff --git a/tests/features1919/java19/SwitchPatternPreview3Error2.java b/tests/features1919/java19/SwitchPatternPreview3Error2.java new file mode 100644 index 000000000..c02c4d3cc --- /dev/null +++ b/tests/features1919/java19/SwitchPatternPreview3Error2.java @@ -0,0 +1,21 @@ +/** + * Inspired by examples in https://openjdk.java.net/jeps/420 + */ +public class SwitchPatternPreview3Error2 { + static void constantLabelsMustAppearBeforePatterns2(Object o) { + switch (o) { + case null -> System.out.println("value unavailable: " + o); + // This seems to be a bug in JEP 420 implementation. Those constants should be compatible with 'Object'. + // case -1, 1 -> System.out.println("absolute value 1: " + o); + // case "hello" -> System.out.println("string value: " + o); + + // 'Integer value' dominates the next two, more specific ones -> error + case Integer value -> System.out.println("other integer: " + o); + case Integer value when (value == 1 || value == -1) -> System.out.println("absolute value 1: " + o); + case Integer value when value > 0 -> System.out.println("positive integer: " + o); + + case String value when value.startsWith("hello") -> System.out.println("greeting: " + o); + default -> System.out.println("other type: " + o); + } + } +} diff --git a/tests/features1919/java19/SwitchPatternPreview3OK.java b/tests/features1919/java19/SwitchPatternPreview3OK.java new file mode 100644 index 000000000..7395f08e9 --- /dev/null +++ b/tests/features1919/java19/SwitchPatternPreview3OK.java @@ -0,0 +1,174 @@ +import java.util.List; +import java.util.Locale; + +/** + * Inspired by examples in https://openjdk.org/jeps/427 + */ +public class SwitchPatternPreview3OK { + public static void main(String[] args) { + + System.out.println(formatterPatternSwitch(null)); + System.out.println(formatterPatternSwitch(123)); + System.out.println(formatterPatternSwitch(999L)); + System.out.println(formatterPatternSwitch(12.34)); + System.out.println(formatterPatternSwitch("foo")); + System.out.println(formatterPatternSwitch(List.of(123, "foo", 999L, 12.34))); + + System.out.println(testCircle(new Rectangle())); + System.out.println(testCircle(new Circle(5))); + System.out.println(testCircle(new Circle(6))); + + System.out.println(testSealedCoverage(new A())); + System.out.println(testSealedCoverage(new B())); + System.out.println(testSealedCoverage(new C(5))); + +// constantLabelMustAppearBeforePattern(-1); +// constantLabelMustAppearBeforePattern(0); +// constantLabelMustAppearBeforePattern(42); +// constantLabelMustAppearBeforePattern(-99); +// constantLabelMustAppearBeforePattern(Integer.valueOf(123)); +// constantLabelMustAppearBeforePattern(null); + + constantLabelMustAppearBeforePatternInteger(-1); + constantLabelMustAppearBeforePatternInteger(0); + constantLabelMustAppearBeforePatternInteger(42); + constantLabelMustAppearBeforePatternInteger(-99); + constantLabelMustAppearBeforePatternInteger(Integer.valueOf(123)); + constantLabelMustAppearBeforePatternInteger(null); + +// System.out.println(testGenericSealedExhaustive(new B<Integer>())); + } + + static String formatterPatternSwitch(Object o) { + return switch (o) { + case null -> "null"; + case Integer i -> String.format("int %d", i); + case Long l -> String.format("long %d", l); + case Double d -> String.format(Locale.ENGLISH, "double %f", d); + case String s -> String.format("String %s", s); + default -> o.toString(); + }; + } + + static class Shape {} + static class Rectangle extends Shape {} + static class Circle extends Shape { + private final double radius; + public Circle(double radius) { this.radius = radius; } + double calculateArea() { return Math.PI * radius * radius; } + } + + static String testCircle(Shape s) { + return switch (s) { + case Circle c when (c.calculateArea() > 100) -> "Large circle"; + case Circle c -> "Small circle"; + default -> "Non-circle"; + }; + } + + sealed interface S permits A, B, C {} + final static class A implements S {} + final static class B implements S {} + static record C(int i) implements S {} // Implicitly final + + static String testSealedCoverage(S s) { + return switch (s) { + case A a -> "Sealed sub-class A"; + case B b -> "Sealed sub-class B"; + case C c -> "Sealed sub-record C"; + }; + } + + /** + * According to an example from JEP 420, this should work, but it does not, neither with Javac nor ECJ. + * + * See: + * https://openjdk.java.net/jeps/420#1b--Dominance-of-pattern-labels + * https://bugs.openjdk.java.net/browse/JDK-8273326 + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=579355 + * + * TODO: reactivate when implemented or move to preview 3 with Java 19, Eclipse 4.24. + */ + /* + static String constantLabelMustAppearBeforePattern(Object o) { + switch (o) { + case null -> System.out.println("value unavailable: " + i); + case -1, 1 -> System.out.println("special case:" + o); + case Integer i && i > 0 -> System.out.println("positive integer: " + o); + case Integer i -> System.out.println("other integer: " + o); + default -> System.out.println("non-integer: " + o); + } + return i == null ? "null" : i.toString(); + } + */ + + static String constantLabelMustAppearBeforePatternInteger(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + case Integer value when value > 0 -> System.out.println("positive integer: " + i); + default -> System.out.println("other integer: " + i); + } + return i == null ? "null" : i.toString(); + } + + static void nullCanAppearAfterConstantLabel(Integer i) { + switch (i) { + case -1, 1 -> System.out.println("absolute value 1: " + i); + case null -> System.out.println("value unavailable: " + i); + case Integer value when value > 0 -> System.out.println("positive integer: " + i); + default -> System.out.println("other integer: " + i); + } + } + + static void defaultCanAppearBeforePattern(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + default -> System.out.println("other integer: " + i); + case Integer value when value > 0 -> System.out.println("positive integer: " + i); + } + } + + static void defaultCanAppearBeforeNull(Integer i) { + switch (i) { + case -1, 1 -> System.out.println("absolute value 1: " + i); + default -> System.out.println("other integer: " + i); + case null -> System.out.println("value unavailable: " + i); + case Integer value when value > 0 -> System.out.println("positive integer: " + i); + } + } + + static void defaultCanAppearBeforeConstantLabel(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + default -> System.out.println("other integer: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + case Integer value when value > 0 -> System.out.println("positive integer: " + i); + } + } + + /** + * According to an example from JEP 420, this should work with preview 2 (Java 18), and it does with Javac, + * but not with ECJ for Java 18 and 19. + * + * See: + * https://openjdk.java.net/jeps/420#2--Exhaustiveness-of-switch-expressions-and-statements + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=579360 + * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/587 + * + * TODO: reactivate when implemented or move to preview 4 with Java 20. + */ + /* + sealed interface I<T> permits A, B {} + final static class A<X> implements I<String> {} + final static class B<Y> implements I<Y> {} + + static int testGenericSealedExhaustive(I<Integer> i) { + return switch (i) { + // Exhaustive as no A case possible! + case B<Integer> bi -> 42; + }; + } + */ +} diff --git a/tests/features199/java18/SwitchPatternPreview2OK.java b/tests/features199/java18/SwitchPatternPreview2OK.java index b36b26bf2..c17fdc12b 100644 --- a/tests/features199/java18/SwitchPatternPreview2OK.java +++ b/tests/features199/java18/SwitchPatternPreview2OK.java @@ -90,13 +90,13 @@ public class SwitchPatternPreview2OK { } /** - * According to an example from JEP 420, this should work, and it does with Javac, but not with ECJ. + * According to an example from JEP 420, this should work with preview 2 (Java 18), and it does with Javac, + * but not with ECJ for Java 18 and 19. * * See: * https://openjdk.java.net/jeps/420#2--Exhaustiveness-of-switch-expressions-and-statements * https://bugs.eclipse.org/bugs/show_bug.cgi?id=579360 - * - * TODO: reactivate when implemented or move to preview 3 with Java 19, Eclipse 4.24. + * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/587 */ /* sealed interface I<T> permits A, B {} diff --git a/tests/pom.xml b/tests/pom.xml index 7b5e400bd..d767dcebc 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>tests</artifactId> diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java index d14bc54cb..21ad9de90 100644 --- a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java @@ -9,6 +9,7 @@ package org.aspectj.systemtest; import org.aspectj.systemtest.ajc190.AllTestsAspectJ190; import org.aspectj.systemtest.ajc191.AllTestsAspectJ191; +import org.aspectj.systemtest.ajc1919.AllTestsAspectJ1919; import org.aspectj.systemtest.ajc192.AllTestsAspectJ192; import org.aspectj.systemtest.ajc193.AllTestsAspectJ193; import org.aspectj.systemtest.ajc195.AllTestsAspectJ195; @@ -38,6 +39,7 @@ public class AllTests19 { suite.addTest(AllTestsAspectJ197.suite()); suite.addTest(AllTestsAspectJ198.suite()); suite.addTest(AllTestsAspectJ199.suite()); + suite.addTest(AllTestsAspectJ1919.suite()); suite.addTest(AllTests18.suite()); // $JUnit-END$ return suite; diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java new file mode 100644 index 000000000..5f471490d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2022 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc1919; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; + +/** + * @author Alexander Kriegisch + */ +public class Ajc1919TestsJava extends XMLBasedAjcTestCaseForJava19OrLater { + + public void testDummyJava19() { + //runTest("dummy Java 19"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1919TestsJava.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1919.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java new file mode 100644 index 000000000..da1a81f97 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2022 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc1919; + +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.util.LangUtil; + +/** + * @author Alexander Kriegisch + */ +public class AllTestsAspectJ1919 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.19 tests"); + suite.addTest(Bugs1919Tests.suite()); + if (LangUtil.is19VMOrGreater()) { + suite.addTest(SanityTestsJava19.suite()); + suite.addTest(Ajc1919TestsJava.suite()); + } + // Do not run tests using a previous compiler's preview features anymore. They would all fail. + // TODO: Comment out the following block when upgrading JDT Core to Java 20 + if (LangUtil.is19VMOrGreater() && !LangUtil.is20VMOrGreater()) { + suite.addTest(Java19PreviewFeaturesTests.suite()); + } + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java new file mode 100644 index 000000000..38441267e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2022 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc1919; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Alexander Kriegisch + */ +public class Bugs1919Tests extends XMLBasedAjcTestCase { + + public void testDummyBug() { + //runTest("dummy Java 19 bug"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Bugs1919Tests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1919.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java new file mode 100644 index 000000000..b4dc12f39 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2022 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc1919; + +import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava19Only; + +/** + * @author Alexander Kriegisch + */ +public class Java19PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava19Only { + + public void testSwitchPatternMatchingPreview3Java() { + runTest("switch pattern matching preview 3 java"); + checkVersion("SwitchPatternPreview3OK", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitchPatternMatchingPreview3Aspect() { + runTest("switch pattern matching preview 3 aspect"); + checkVersion("SwitchPatternPreview3Aspect", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Application", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Shape", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); + checkVersion("S", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { + runTest("switch pattern matching error"); + } + + public void testSwitchPatternMatchingPreview3Error1() { + runTest("switch pattern matching preview 3 error 1"); + } + + public void testSwitchPatternMatchingPreview3Error2() { + runTest("switch pattern matching preview 3 error 2"); + } + + public void testRecordPatternsPreview1OK() { + // See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 + runTest("record patterns"); + } + + public void testRecordPatternsPreview1Error() { + // See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 + runTest("record patterns error"); + } + + public void testRecordPatternsPreview1ExhaustivenessOK1() { + // Falsely throws 'An enhanced switch statement should be exhaustive; a default label expected' twice, + // see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + // TODO: activate when fixed + System.out.println("TODO: activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed"); + //runTest("record patterns exhaustiveness 1"); + } + + public void testRecordPatternsPreview1Aspect() { + runTest("record patterns aspect"); + } + + public void testRecordPatternsPreview1ExhaustivenessAspect() { + // TODO: Remove redundant default clauses in RecordPatternsPreview1Aspect when + // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed. Furthermore, activate '<run />' + // action for XML test case in order to not just compile but also run the code. + System.out.println("TODO: fully activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed"); + runTest("record patterns exhaustiveness aspect"); + } + + public void testRecordPatternsPreview1ExhaustivenessError() { + // See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + runTest("record patterns exhaustiveness error"); + } + + public void testRecordPatternsPreview1ExhaustivenessOK2() { + // Falsely throws 'An enhanced switch statement should be exhaustive; a default label expected', + // see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/398 + // TODO: activate when fixed + System.out.println("TODO: activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/398 has been fixed"); + //runTest("record patterns exhaustiveness 2"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Java19PreviewFeaturesTests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1919.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java new file mode 100644 index 000000000..fa2abafe5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2022 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc1919; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; + +/* + * Some very trivial tests that help verify things are OK. + * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -19 option + * to check code generation and modification with that version specified. + * + * @author Alexander Kriegisch + */ +public class SanityTestsJava19 extends XMLBasedAjcTestCaseForJava19OrLater { + + public static final int bytecode_version_for_JDK_level = 63; + + // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) + public void testSimpleJava_A() { + runTest("simple - a"); + } + + public void testSimpleJava_B() { + runTest("simple - b"); + } + + public void testSimpleCode_C() { + runTest("simple - c"); + } + + public void testSimpleCode_D() { + runTest("simple - d"); + } + + public void testSimpleCode_E() { + runTest("simple - e"); + } + + public void testSimpleCode_F() { + runTest("simple - f"); + } + + public void testSimpleCode_G() { + runTest("simple - g"); + } + + public void testSimpleCode_H() { + runTest("simple - h", true); + } + + public void testSimpleCode_I() { + runTest("simple - i"); + } + + public void testVersionCorrect1() { + runTest("simple - j"); + checkVersion("A", bytecode_version_for_JDK_level, 0); + } + + public void testVersionCorrect2() { + runTest("simple - k"); + checkVersion("A", bytecode_version_for_JDK_level, 0); + } + + public void testVersionCorrect4() { + runTest("simple - m"); + // Must be 49.0 when -1.5 is specified + checkVersion("A", 49, 0); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava19.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-19.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java index c2e13b550..d3cbfb9ab 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java @@ -26,7 +26,7 @@ public class AllTestsAspectJ196 { // Do not run tests using a previous compiler's preview features anymore. They would all fail. /* if (LangUtil.is14VMOrGreater() && !LangUtil.is15VMOrGreater()) { - suite.addTest(Ajc196PreviewFeaturesTests.suite()); + suite.addTest(Java14PreviewFeaturesTests.suite()); } */ return suite; diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java index 7040deba4..2b3ad813a 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Contributors + * Copyright (c) 2022 Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; public class Ajc199TestsJava extends XMLBasedAjcTestCaseForJava18OrLater { public void testDummyJava18() { - runTest("dummy Java 18"); + //runTest("dummy Java 18"); } public static Test suite() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java index 9cb01eec8..6b77073be 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Contributors + * Copyright (c) 2022 Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at @@ -23,9 +23,12 @@ public class AllTestsAspectJ199 { suite.addTest(SanityTestsJava18.suite()); suite.addTest(Ajc199TestsJava.suite()); } + // Do not run tests using a previous compiler's preview features anymore. They would all fail. + /* if (LangUtil.is18VMOrGreater() && !LangUtil.is19VMOrGreater()) { suite.addTest(Java18PreviewFeaturesTests.suite()); } + */ return suite; } } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java index 5b2087ed2..9d1dc6c6d 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Contributors + * Copyright (c) 2022 Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java index dbe6f733a..8afe68946 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Contributors + * Copyright (c) 2022 Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java index d86e11454..2fd9d2660 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Contributors + * Copyright (c) 2022 Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at @@ -13,7 +13,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; /* * Some very trivial tests that help verify things are OK. - * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -17 option + * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -18 option * to check code generation and modification with that version specified. * * @author Alexander Kriegisch diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java index 5a3cab221..52602114e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -67,13 +67,14 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio for (File dir: allOutputPaths) { sb.append(File.pathSeparator + dir.getAbsolutePath()); } - String cp = sb.toString() + File.pathSeparator + new File(AjdeInteractionTestbed.testdataSrcDir) + File.pathSeparator - + System.getProperty("sun.boot.class.path") + File.pathSeparator + "../runtime/target/classes" + File.pathSeparator - + this.classPath + File.pathSeparator + System.getProperty("aspectjrt.path") + File.pathSeparator - + "../lib/junit/junit.jar" + "c:/batik/batik-1.6/lib/batik-util.jar;" - + "c:/batik/batik-1.6/lib/batik-awt-util.jar;" + "c:/batik/batik-1.6/lib/batik-dom.jar;" - + "c:/batik/batik-1.6/lib/batik-svggen.jar;" + File.pathSeparator + ".." + File.separator + "lib" + File.separator - + "test" + File.separator + "aspectjrt.jar"; + String cp = sb + File.pathSeparator + + new File(AjdeInteractionTestbed.testdataSrcDir) + File.pathSeparator + + System.getProperty("sun.boot.class.path") + File.pathSeparator + + "../runtime/target/classes" + File.pathSeparator + + this.classPath + File.pathSeparator + + System.getProperty("aspectjrt.path") + File.pathSeparator + + "../lib/junit/junit.jar" + File.pathSeparator + + ".." + File.separator + "lib" + File.separator + "test" + File.separator + "aspectjrt.jar"; verifyClasspath(cp); if (LangUtil.is9VMOrGreater()) { cp = LangUtil.getJrtFsFilePath() + File.pathSeparator + cp; diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml index 7963070e0..63313f624 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml @@ -2750,8 +2750,8 @@ <line text="@target(Classified) at call(Class java.lang.Object.getClass())"/> <line text="1 @Foo()"/> <line text="1 @Foo()"/> - <line text="1 @Classified(classification=TOP-SECRET)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="1 @Classified(classification="TOP-SECRET")" vm="9+"/> + <line text="1 @Classified(classification=TOP-SECRET)" vm="-1.8"/> + <line text="1 @Classified(classification="TOP-SECRET")" vm="9-"/> <line text="This information is TOP-SECRET"/> <line text="Entering critical join point with priority 3"/> <line text="Entering critical join point with reflectively obtained priority 3"/> @@ -3746,65 +3746,65 @@ <run class="GenericAspectRuntimePointcuts"> <stdout> <line text="target-ok an X execution(void X.foo())"/> - <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9-13"/> + <line text="@this-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9-13"/> + <line text="@target-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9-13"/> + <line text="@within-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14-"/> <line text="cflow-ok an X a Y set(Y X.y)"/> - <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok-sub @MyAnnotation(value="bar") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok-sub @MyAnnotation("bar") execution(void X.bar())" vm="14+"/> - <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok @MyAnnotation(value="bar") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok @MyAnnotation("bar") execution(void X.bar())" vm="14+"/> + <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="bar") execution(void X.bar())" vm="9-13"/> + <line text="@annotation-ok-sub @MyAnnotation("bar") execution(void X.bar())" vm="14-"/> + <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok @MyAnnotation(value="bar") execution(void X.bar())" vm="9-13"/> + <line text="@annotation-ok @MyAnnotation("bar") execution(void X.bar())" vm="14-"/> <line text="target-ok an X execution(void X.bar())"/> - <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14+"/> - <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@args-ok @MyAnnotation(value="my-value") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@args-ok @MyAnnotation("my-value") execution(void Y.foo(X))" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9-13"/> + <line text="@this-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9-13"/> + <line text="@target-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9-13"/> + <line text="@within-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14-"/> + <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@args-ok @MyAnnotation(value="my-value") execution(void Y.foo(X))" vm="9-13"/> + <line text="@args-ok @MyAnnotation("my-value") execution(void Y.foo(X))" vm="14-"/> <line text="args-ok an X execution(void Y.foo(X))"/> <line text="this-ok a Y execution(void Y.foo(X))"/> - <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14+"/> - <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok-sub @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok-sub @MyAnnotation("my-value") execution(X Y.bar())" vm="14+"/> - <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok @MyAnnotation("my-value") execution(X Y.bar())" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9-13"/> + <line text="@this-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9-13"/> + <line text="@target-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9-13"/> + <line text="@within-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14-"/> + <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9-13"/> + <line text="@annotation-ok-sub @MyAnnotation("my-value") execution(X Y.bar())" vm="14-"/> + <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9-13"/> + <line text="@annotation-ok @MyAnnotation("my-value") execution(X Y.bar())" vm="14-"/> <line text="this-ok a Y execution(X Y.bar())"/> - <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14+"/> - <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5,1.6,1.7,1.8"/> - <line text="@withincode-ok @MyAnnotation(value="my-value") get(X Y.x)" vm="9,10,11,12,13"/> - <line text="@withincode-ok @MyAnnotation("my-value") get(X Y.x)" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9-13"/> + <line text="@this-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9-13"/> + <line text="@target-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9-13"/> + <line text="@within-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14-"/> + <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5-1.8"/> + <line text="@withincode-ok @MyAnnotation(value="my-value") get(X Y.x)" vm="9-13"/> + <line text="@withincode-ok @MyAnnotation("my-value") get(X Y.x)" vm="14-"/> </stdout> </run> </ajc-test> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml index 8d8cd66b8..3588f5950 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml @@ -4,7 +4,7 @@ <suite> <!-- atDecp begin --> - + <!-- something simple --> <ajc-test dir="bugs151/atDecp/case1" title="atDecp - simple"> <compile files="MainClass.java" options="-1.5 -showWeaveInfo"> @@ -20,7 +20,7 @@ </stderr> </run> </ajc-test> - + <!-- applying parent based on annotation --> <ajc-test dir="bugs151/atDecp/case2" title="atDecp - annotation"> <compile files="MainClass.java" options="-1.5 -showWeaveInfo"> @@ -36,7 +36,7 @@ </stderr> </run> </ajc-test> - + <!-- when interface is binary --> <ajc-test dir="bugs151/atDecp/case3" title="atDecp - binary interface"> <compile files="Mood.java,Moody.java" outjar="moody.jar" options="-1.5"/> @@ -53,7 +53,7 @@ </stderr> </run> </ajc-test> - + <!-- when interface is binary and implementation is not an inner --> <ajc-test dir="bugs151/atDecp/case4" title="atDecp - binary interface - 2"> <compile files="Mood.java,Moody.java" outjar="moody.jar" options="-1.5"/> @@ -70,7 +70,7 @@ </stderr> </run> </ajc-test> - + <!-- atDecp end --> @@ -92,22 +92,22 @@ <compile files="Failing.java" options="-1.5"/> <run class="Failing"> <stderr> - <line text="On TestInterface:@TestAnnotation(value=true)" vm="1.5,1.6,1.7,1.8,9,10,11,12,13"/> - <line text="On TestInterface:@TestAnnotation(true)" vm="14+"/> - <line text="On Failing:@TestAnnotation(value=true)" vm="1.5,1.6,1.7,1.8,9,10,11,12,13"/> - <line text="On Failing:@TestAnnotation(true)" vm="14+"/> + <line text="On TestInterface:@TestAnnotation(value=true)" vm="1.5-13"/> + <line text="On TestInterface:@TestAnnotation(true)" vm="14-"/> + <line text="On Failing:@TestAnnotation(value=true)" vm="1.5-13"/> + <line text="On Failing:@TestAnnotation(true)" vm="14-"/> </stderr> </run> </ajc-test> - + <ajc-test dir="bugs151/pr98901" title="annotations and itds - 2"> <compile files="Failing2.java" options="-1.5"/> <run class="Failing2"> <stderr> - <line text="On TestInterface:@TestAnnotation(value=true)" vm="1.5,1.6,1.7,1.8,9,10,11,12,13"/> - <line text="On TestInterface:@TestAnnotation(true)" vm="14+"/> - <line text="On Failing2:@TestAnnotation(value=true)" vm="1.5,1.6,1.7,1.8,9,10,11,12,13"/> - <line text="On Failing2:@TestAnnotation(true)" vm="14+"/> + <line text="On TestInterface:@TestAnnotation(value=true)" vm="1.5-13"/> + <line text="On TestInterface:@TestAnnotation(true)" vm="14-"/> + <line text="On Failing2:@TestAnnotation(value=true)" vm="1.5-13"/> + <line text="On Failing2:@TestAnnotation(true)" vm="14-"/> </stderr> </run> </ajc-test> @@ -120,23 +120,23 @@ <compile files="InputAnnotation.java" outjar="foo.jar" options="-1.5"/> <compile files="AffectedType.java" classpath="foo.jar" options="-1.5"/> </ajc-test> - + <ajc-test dir="bugs151/pr132926" pr="132926" title="crashing on annotation type resolving with asm - 3"> <compile files="InputAnnotation2.java" outjar="foo.jar" options="-1.5"/> <compile files="AffectedType.java" classpath="foo.jar" options="-1.5"> <message kind="error" line="9" text="AffectedType is not a valid target for annotation InputAnnotation, this annotation can only be applied to these element types {METHOD}"/> </compile> </ajc-test> - + <ajc-test dir="bugs151/pr133307" title="circular generics"> <compile files="Broken.aj" options="-1.5"/> - </ajc-test> - + </ajc-test> + <ajc-test dir="bugs151/pr123553" title="generic advice parameters"> <compile files="A.java" options="-1.5"/> <run class="A"/> - </ajc-test> - + </ajc-test> + <ajc-test dir="bugs151/pr133298" title="doubly annotating a method with declare"> <compile files="DecA.java" options="-1.5"/> <run class="DecA"> @@ -153,7 +153,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs151/pr133298" title="doubly annotating a method with declare - 2"> <compile files="DecA2.java" options="-1.5"/> <run class="DecA2"> @@ -167,19 +167,19 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs151/pr129566" title="arrayindexoutofbounds"> <compile files="SkipList.java" options="-1.5"/> - </ajc-test> - + </ajc-test> + <ajc-test dir="bugs151" title="member types in generic types"> <compile files="pr122458.aj" options="-1.5 -emacssym"/> - </ajc-test> - + </ajc-test> + <ajc-test dir="bugs151/pr127299" title="missing import gives funny message"> <compile files="ModelErrorConversion.aj" options="-1.5"/> </ajc-test> - + <ajc-test dir="bugs151/pr122742" title="@AJ VerifyError with @AfterThrowing and thisJoinPoint argument"> <compile files="AfterThrowingTest.java" options="-1.5"/> <run class="AfterThrowingTest"> @@ -191,32 +191,32 @@ <run class="AfterReturningTest"> </run> </ajc-test> - + <ajc-test dir="bugs151/pr120527" title="incorrect unused interface message"> <compile files="Bugs.aj" options="-warn:unusedPrivate"/> - </ajc-test> - + </ajc-test> + <ajc-test dir="bugs151/pr123901" title="inlinevisitor NPE"> <compile files="A.java,B.java" options="-1.5"> <message kind="error" line="5" text="A cannot be resolved or is not a field"/> </compile> </ajc-test> - + <ajc-test dir="bugs151" title="member types in generic types - 2"> <compile files="pr122458_2.aj" options="-1.5 -emacssym"/> <run class="pr122458_2"/> </ajc-test> - + <ajc-test dir="bugs151/pr123695" title="Internal nullptr exception with complex declare annotation"> <compile files="InjectName.java,Main.java,MarkMyMethods.java,MarkMyMethodsAspect.java,NameAspect.java,Named.java,Read.java,Write.java" options="-1.5"/> </ajc-test> - + <ajc-test dir="bugs151/pr124105" title="hasMember problems with packages"> <compile files="com/test/IOption.java,com/test/IXOption.java,com/test/IYOption.java,com/test/IZOption.java,com/test/MyBrokenXOption.java,com/test/MyXOption.java,com/test/OptionAspect.aj,com/test/OptionType.java" options="-1.5 -XhasMember"> <message kind="error" line="4" text="IOption implementations must provide a constructor which accepts an OptionType"/> </compile> </ajc-test> - + <ajc-test dir="bugs151/pr124803" title="generics and different numbers of type variables"> <compile files="Test.java,TestAspect.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'method-execution(void Test.foo(java.lang.Number))' in Type 'Test' (Test.java:12) advised by after advice from 'TestAspect' (TestAspect.java:4)"/> @@ -227,7 +227,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs151/pr124803" title="generics and different numbers of type variables - classes"> <compile files="Test2.java,TestAspect2.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'method-execution(void Test2.foo(java.lang.Number))' in Type 'Test2' (Test2.java:12) advised by after advice from 'TestAspect2' (TestAspect2.java:4)"/> @@ -239,7 +239,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs151/pr124808" title="parameterized collection fields matched via pointcut"> <compile files="Test.java,TestAspect.java" options="-1.5"/> <run class="Test"> @@ -248,12 +248,12 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs151" title="calling inherited generic method from around advice"> <compile files="pr124999.aj" options="-1.5"/> <run class="pr124999"/> </ajc-test> - + <ajc-test dir="bugs151/pr124654" title="generic aspects and annotations"> <compile files="GenericAnnotation.java,TestSubAspect.java" options="-1.5"/> <run class="TestSubAspect"> @@ -264,7 +264,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs151" title="incorrectly referencing pointcuts"> <compile files="pr122452.aj" options="-1.5"> <message kind="warning" line="2" text="no match for this type name: Point [Xlint:invalidAbsoluteTypeName]"/> @@ -272,18 +272,18 @@ <message kind="error" line="4" text="Syntax error on token "*", "(" expected"/> </compile> </ajc-test> - + <ajc-test dir="bugs151" title="incorrectly referencing pointcuts - 2"> <compile files="pr122452_2.aj" options="-1.5"> <message kind="error" line="2" text="Syntax error on token "*", "(" expected"/> </compile> </ajc-test> - + <ajc-test dir="bugs151/pr125080" title="mixing numbers of type parameters"> <compile files="Test.java" options="-1.5"/> <run class="ConcreteAspect"/> </ajc-test> - + <ajc-test dir="bugs151/pr125080" title="mixing numbers of type parameters - 2"> <compile files="Test2.java" options="-1.5"/> <run class="ConcreteAspect"/> @@ -292,11 +292,11 @@ <ajc-test dir="bugs151/pr125295" title="new IProgramElement methods"> <compile files="pkg/C.java,pkg/A.aj" options="-emacssym"/> </ajc-test> - + <ajc-test dir="bugs151/pr125475" title="define empty pointcut using an annotation"> <compile files="TestEmptyPointcutAtAspect.java" options="-1.5"/> </ajc-test> - + <ajc-test dir="bugs151/pr125475" title="define empty pointcut using an annotation - 2"> <compile files="TestEmptyPointcutAtAspect2.java" options="-1.5 -showWeaveInfo"> <message kind="warning" line="10" text="advice defined in TestEmptyPointcutAtAspect2 has not been applied [Xlint:adviceDidNotMatch]"/> @@ -307,7 +307,7 @@ <compile files="Test.java TestAspect.aj"/> <run class="Test" ltw="aop.xml"/> </ajc-test> - + <ajc-test dir="bugs151/pr128744" title="broken ltw"> <compile files="Hello.java World.java" options="-1.5" /> <run class="Hello" ltw="aop.xml"> @@ -317,7 +317,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="bugs151/pr125699" title="inherit advice with this() and thisJoinPoint"> <compile files="Tracing.aj, TestTracing.aj, AtTestTracing.java" options="-1.5"> <message kind="warning" line="13" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/> @@ -345,7 +345,7 @@ <ajc-test dir="bugs151" title="E extends Enum(E) again"> <compile files="Pr126316.aj" options="-1.5"/> - </ajc-test> + </ajc-test> <ajc-test dir="bugs151" title="@AJ without JoinPoint import"> <compile files="pr121616.java" options="-1.5"> @@ -379,7 +379,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="bugs151" title="Pointcut interfaces"> <compile files="pr130869.aj" options="-1.5"> <message kind="warning" line="30" text="no directly runnable classes"/> @@ -390,10 +390,10 @@ <compile files="pr131933.aj" options="-1.5"> <message kind="error" line="5" text="can't bind type name 'MyList'"/> </compile> - </ajc-test> + </ajc-test> <!-- New features down here... when they arent big enough to have their own test file --> - + <ajc-test dir="features151/ptw" title="exposing withintype"> <compile files="ExposedType.java" options="-1.5"/> <run class="ExposedType"> @@ -403,8 +403,8 @@ <line text="here I am execution(void ExposedTypeThree.foo()): for class ExposedTypeThree"/> </stderr> </run> - </ajc-test> - + </ajc-test> + <ajc-test dir="features151/swallowedExceptions" title="swallowed exceptions"> <compile files="SwallowedException.java" options="-Xlint:warning"> <message kind="warning" line="11" text="Exception swallowed in catch block"/> @@ -415,4 +415,4 @@ <compile files="SwallowedException.java"> </compile> </ajc-test> -</suite>
\ No newline at end of file +</suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml index a0d38cb6c..8ed8e3ffc 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml @@ -27,8 +27,8 @@ </compile> <run class="c.d.DistantResource"> <stdout> - <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="Annotation is @a.b.SimpleAnnotation(classname="oranges")" vm="9+"/> + <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="-1.8"/> + <line text="Annotation is @a.b.SimpleAnnotation(classname="oranges")" vm="9-"/> </stdout> </run> </ajc-test> @@ -40,8 +40,8 @@ </compile> <run class="c.d.DistantResource"> <stdout> - <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="Annotation is @a.b.SimpleAnnotation(classname="oranges")" vm="9+"/> + <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="-1.8"/> + <line text="Annotation is @a.b.SimpleAnnotation(classname="oranges")" vm="9-"/> </stdout> </run> </ajc-test> @@ -53,8 +53,8 @@ </compile> <run class="c.d.DistantResource"> <stdout> - <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="-1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9-"/> </stdout> </run> </ajc-test> @@ -66,8 +66,8 @@ </compile> <run class="c.d.DistantResource"> <stdout> - <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="-1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9-"/> </stdout> </run> </ajc-test> @@ -80,8 +80,8 @@ </compile> <run class="c.d.DistantResource"> <stdout> - <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="-1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9-"/> </stdout> </run> </ajc-test> @@ -95,8 +95,8 @@ </compile> <run class="c.d.DistantResource"> <stdout> - <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="-1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9-"/> </stdout> </run> </ajc-test> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml index 914042633..86e135979 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml @@ -19,7 +19,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="adding and removing"> <compile files="OnOff.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="'public int field2' of type 'OnOff' (OnOff.java) is annotated with @Anno field annotation from 'Foo' (OnOff.java:12)"/> @@ -34,8 +34,8 @@ </stdout> </run> </ajc-test> - - + + <ajc-test dir="features1611/declareMinus" title="adding and removing - 2"> <compile files="OnOff2.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="'public int field2' of type 'OnOff2' (OnOff2.java) is annotated with @Anno field annotation from 'Foo' (OnOff2.java:8)"/> @@ -50,14 +50,14 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="declare minus - 1"> <compile files="Code.java" options="-1.5"/> <run class="Code"> <stdout> <line text="no annotation"/> </stdout></run> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="declare minus - itd"> <compile files="Code2.java" options="-1.5"/> <run class="Code2"> @@ -65,7 +65,7 @@ <line text="no annotation"/> </stdout></run> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="declare minus - 2 annos"> <compile files="Code3.java" options="-1.5"/> <run class="Code3"> @@ -74,7 +74,7 @@ <line text="has AnnoB"/> </stdout></run> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="declare minus - multifiles"> <compile files="aspectjtest/AnnotationA.java aspectjtest/AnnotationB.java aspectjtest/ExampleItd.aj aspectjtest/HelloTest.java aspectjtest/MyEntity.java" options="-1.5"/> <run class="aspectjtest.HelloTest"> @@ -83,7 +83,7 @@ <line text="interface aspectjtest.AnnotationB"/> </stdout></run> </ajc-test> - + <!-- different ordering --> <ajc-test dir="features1611/declareMinus" title="declare minus - multifiles - 2"> <compile files="aspectjtest/MyEntity.java aspectjtest/AnnotationA.java aspectjtest/AnnotationB.java aspectjtest/ExampleItd.aj aspectjtest/HelloTest.java" options="-1.5"/> @@ -103,18 +103,18 @@ <line text="interface aspectjtest.AnnotationB"/> </stdout></run> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="declare minus - with values"> <compile files="WithValues.java" options="-1.5"/> <run class="WithValues"> <stdout> <line text="i does not have Anno"/> - <line text="j has Banno:@Banno(hoo=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="j has Banno:@Banno(hoo="abc")" vm="9+"/> + <line text="j has Banno:@Banno(hoo=abc)" vm="-1.8"/> + <line text="j has Banno:@Banno(hoo="abc")" vm="9-"/> <line text="j does not have Anno"/> </stdout></run> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="declare minus - unsupported"> <compile files="Unsupported.java" options="-1.5"> <message kind="error" line="19" text="Annotation removal only supported for declare @field (compiler limitation)"/> @@ -122,7 +122,7 @@ <message kind="error" line="21" text="Annotation removal does not allow values to be specified for the annotation (compiler limitation)"/> </compile> </ajc-test> - + <ajc-test dir="features1611/declareMinus" title="binary weaving"> <compile files="aspectjtest/AnnotationA.java aspectjtest/AnnotationB.java aspectjtest/MyEntity.java aspectjtest/HelloTest.java" outjar="code.jar" options="-1.5"/> <compile files="aspectjtest/ExampleItd.aj" inpath="code.jar" options="-1.5 -showWeaveInfo"> @@ -135,5 +135,5 @@ <line text="interface aspectjtest.AnnotationB"/> </stdout></run> </ajc-test> - + </suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml index 650bdea43..d7423a194 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml @@ -7,7 +7,8 @@ <run class="AspectWithConstant"> <stdout> <line text="MAX=9"/> - <line text="@AspectWithConstant$Loggable()"/> + <line text="@AspectWithConstant$Loggable()" vm="-18"/> + <line text="@AspectWithConstant.Loggable()" vm="19-"/> </stdout></run> </ajc-test> @@ -257,10 +258,10 @@ <compile files="AnnoBinding2.java" options="-1.5"/> <run class="AnnoBinding2"> <stdout> -<line text="get(int AnnoBinding2.field1) @Marker(message=foo)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> -<line text="get(int AnnoBinding2.field1) @Marker(message="foo")" vm="9+"/> -<line text="get(int AnnoBinding2.field2) @Marker(message=bar)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> -<line text="get(int AnnoBinding2.field2) @Marker(message="bar")" vm="9+"/> +<line text="get(int AnnoBinding2.field1) @Marker(message=foo)" vm="-1.8"/> +<line text="get(int AnnoBinding2.field1) @Marker(message="foo")" vm="9-"/> +<line text="get(int AnnoBinding2.field2) @Marker(message=bar)" vm="-1.8"/> +<line text="get(int AnnoBinding2.field2) @Marker(message="bar")" vm="9-"/> <line text="2 ajc$anno$NNN fields"/> </stdout> </run> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc169/intertype.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc169/intertype.xml index 185e3084c..e4dbec2fa 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc169/intertype.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc169/intertype.xml @@ -1,7 +1,7 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> <suite> - + <ajc-test dir="features169/itdInnerTypes/separate" title="separate compilation"> <compile files="Basic.java" options="-1.5"/> <compile files="Basic2.java"/> @@ -11,7 +11,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/separate2" title="separate compilation - 2"> <compile files="Basic.java" options="-1.5"/> <compile files="Basic2.java"/> @@ -28,7 +28,7 @@ <message kind="error" text="target type already declares a "/> </compile> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="construction4"> <compile files="Construction4.java" options="-1.5"/> <run class="Construction4"> @@ -37,7 +37,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="construction3"> <compile files="Construction3.java" options="-1.5"/> <run class="Construction3"> @@ -46,7 +46,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/ten" title="construction2"> <compile files="Construction.java Aspect1.java Aspect2.java" options="-1.5"/> <run class="Construction"> @@ -55,7 +55,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="construction"> <compile files="Construction.java" options="-1.5"/> <run class="Construction"> @@ -64,91 +64,98 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/nine" title="vote - itd mixture 2"> <compile files="Underscorer.aj Vote.java Runner.java RelatedType.java" options="-1.5"/> <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9,10,11,12,13"/> - <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14+"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="-1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9-13"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14-18"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote._.choice.class)" vm="19-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/eight" title="vote - itd mixture"> <compile files="Underscorer.aj Vote.java Runner.java RelatedType.java" options="-1.5"/> <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9,10,11,12,13"/> - <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14+"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="-1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9-13"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14-18"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote._.choice.class)" vm="19-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/seven" title="vote - method reference"> <compile files="Underscorer.aj Vote.java Runner.java RelatedType.java" options="-1.5"/> <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9,10,11,12,13"/> - <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14+"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="-1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9-13"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14-18"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote._.choice.class)" vm="19-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/six" title="vote - field reference"> <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9,10,11,12,13"/> - <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14+"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="-1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9-13"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14-18"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote._.choice.class)" vm="19-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/five" title="vote - inner inner"> <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9,10,11,12,13"/> - <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14+"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="-1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9-13"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14-18"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote._.choice.class)" vm="19-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/four" title="vote - reference via annotation - two"> <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9,10,11,12,13"/> - <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14+"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="-1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9-13"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote$_$choice.class)" vm="14-18"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote._.choice.class)" vm="19-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/three" title="vote - reference via annotation"> <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_.class)" vm="9,10,11,12,13"/> - <line text="@a.b.c.RelatedType(a.b.c.Vote$_.class)" vm="14+"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_)" vm="-1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_.class)" vm="9-13"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote$_.class)" vm="14-18"/> + <line text="@a.b.c.RelatedType(a.b.c.Vote._.class)" vm="19-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/two" title="vote - construction"> <compile files="Vote.java Vote_Amender.aj Runner.java" options="-1.5"/> <run class="a.b.c.Runner"> @@ -157,12 +164,12 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes/one" title="vote - basic"> <compile files="Vote.java Vote_Amender.aj Runner.java" options="-1.5"/> <run class="a.b.c.Runner"/> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="choice - generics 1"> <compile files="ChoiceGenerics1.java" options="-1.5"/> </ajc-test> @@ -172,7 +179,7 @@ <message kind="error" text="Type mismatch: cannot convert from String to Integer"/> </compile> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="choice"> <compile files="Choice.java" options="-1.5"/> <run class="Choice"> @@ -180,17 +187,17 @@ <line text="null"/> </stdout></run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="choice - weaveinfo"> <compile files="Choice.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Type 'Choice' (Choice.java) has intertyped member class from 'X' (Choice.java)"/> </compile> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="choice - model"> <compile files="Choice.java" options="-1.5 -emacssym"/> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="choice2"> <compile files="Choice2.java" options="-1.5"/> <run class="Choice2"> @@ -198,7 +205,7 @@ <line text="null"/> </stdout></run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="field access"> <compile files="FieldAccess.java" options="-1.5"/> <run class="FieldAccess"> @@ -206,7 +213,7 @@ <line text="42"/> </stdout></run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="method access"> <compile files="MethodCall.java" options="-1.5"/> <run class="MethodCall"> @@ -214,43 +221,43 @@ <line text="42"/> </stdout></run> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="only static"> <compile files="OnlyStatic.java" options="-1.5"> <message kind="error" line="5" text="Intertype declared member types can only be static (compiler limitation)"/> </compile> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="on interface"> <compile files="OnInterface.java" options="-1.5"> <message kind="error" line="5" text="Cannot declare new member type on 'OnInterface'. New member types can only be specified on classes (compiler limitation)"/> </compile> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="on enum"> <compile files="OnEnum.java" options="-1.5"> <message kind="error" line="6" text="Cannot declare new member type on 'EEE'. New member types can only be specified on classes (compiler limitation)"/> </compile> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="on annotation"> <compile files="OnAnnotation.java" options="-1.5"> <message kind="error" line="8" text="Cannot declare new member type on 'Anno'. New member types can only be specified on classes (compiler limitation)"/> </compile> </ajc-test> - - <!-- + + <!-- <ajc-test dir="features169/itdInnerTypes" title="simplest 3"> <compile files="Simplest3.java" options="-1.5"/> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="simplest 2"> <compile files="Simplest2.java" options="-1.5"/> </ajc-test> - + <ajc-test dir="features169/itdInnerTypes" title="simplest"> <compile files="Simplest.java" options="-1.5"/> </ajc-test> --> - -</suite>
\ No newline at end of file + +</suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml index f3f18f6d9..5fe1c9ffa 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml @@ -182,16 +182,16 @@ <line text="Annotations on field1? true"/> <line text="Annotation count is 4"/> <line text="@AnnoBoolean(value=true, zzz=false)"/> - <line text="@AnnoClass(value=class java.lang.Integer, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@AnnoClass(value=java.lang.Integer.class, ccc=java.lang.String.class)" vm="9+"/> - <line text="@AnnoLong(value=999L, jjj=111L)" vm="14+"/> - <line text="@AnnoLong(value=999, jjj=111)" vm="1.2,1.3,1.4,1.5,1.6,1.6,1.8,9,10,11,12,13"/> - <line text="@AnnoString(value=set from xml, sss=xyz)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@AnnoString(value="set from xml", sss="xyz")" vm="9+"/> + <line text="@AnnoClass(value=class java.lang.Integer, ccc=class java.lang.String)" vm="-1.8"/> + <line text="@AnnoClass(value=java.lang.Integer.class, ccc=java.lang.String.class)" vm="9-"/> + <line text="@AnnoLong(value=999L, jjj=111L)" vm="14-"/> + <line text="@AnnoLong(value=999, jjj=111)" vm="-13"/> + <line text="@AnnoString(value=set from xml, sss=xyz)" vm="-1.8"/> + <line text="@AnnoString(value="set from xml", sss="xyz")" vm="9-"/> <line text="Annotations on field2? true"/> <line text="Annotation count is 1"/> - <line text="@AnnoClass(value=class java.lang.String, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@AnnoClass(value=java.lang.String.class, ccc=java.lang.String.class)" vm="9+"/> + <line text="@AnnoClass(value=class java.lang.String, ccc=class java.lang.String)" vm="-1.8"/> + <line text="@AnnoClass(value=java.lang.String.class, ccc=java.lang.String.class)" vm="9-"/> </stdout> </run> </ajc-test> @@ -202,16 +202,16 @@ <stdout> <line text="Annotations on field1? true"/> <line text="Annotation count is 4"/> - <line text="@AnnoChar(value=z, ccc=a)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@AnnoChar(value='z', ccc='a')" vm="9+"/> + <line text="@AnnoChar(value=z, ccc=a)" vm="-1.8"/> + <line text="@AnnoChar(value='z', ccc='a')" vm="9-"/> <line text="@AnnoDouble(value=99.0,ddd=3.0)"/> - <line text="@AnnoFloat(value=6.0, fff=4.0)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@AnnoFloat(value=6.0f, fff=4.0f)" vm="9+"/> + <line text="@AnnoFloat(value=6.0, fff=4.0)" vm="-1.8"/> + <line text="@AnnoFloat(value=6.0f, fff=4.0f)" vm="9-"/> <line text="@AnnoShort(value=8, sss=3)"/> <line text="Annotations on field2? true"/> <line text="Annotation count is 2"/> - <line text="@AnnoByte(value=88, bbb=66)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8,9,10,11,12,13"/> - <line text="@AnnoByte(value=(byte)0x58, bbb=(byte)0x42)" vm="14+"/> + <line text="@AnnoByte(value=88, bbb=66)" vm="-13"/> + <line text="@AnnoByte(value=(byte)0x58, bbb=(byte)0x42)" vm="14-"/> <line text="@AnnoInt(iii=111, value=99)"/> </stdout> </run> @@ -223,8 +223,8 @@ <stdout> <line text="Annotations on field1? true"/> <line text="Annotation count is 1"/> - <line text="@Annot(a=a, fred=false, value=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@Annot(a='a', fred=false, value="abc")" vm="9+"/> + <line text="@Annot(a=a, fred=false, value=abc)" vm="-1.8"/> + <line text="@Annot(a='a', fred=false, value="abc")" vm="9-"/> </stdout> </run> </ajc-test> @@ -235,8 +235,8 @@ <stdout> <line text="Annotations on field1? true"/> <line text="Annotation count is 1"/> - <line text="@Annot(a=a, fred=false, value=abc)" vm="1.4,1.5,1.6,1.7,1.8"/> - <line text="@Annot(a='a', fred=false, value="abc")" vm="9+"/> + <line text="@Annot(a=a, fred=false, value=abc)" vm="1.4-1.8"/> + <line text="@Annot(a='a', fred=false, value="abc")" vm="9-"/> </stdout> </run> </ajc-test> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc173/ajc173.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc173/ajc173.xml index 398fae62f..a60fca98c 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc173/ajc173.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc173/ajc173.xml @@ -5,40 +5,40 @@ <ajc-test dir="bugs173/pr407739" title="add remove annos"> <compile files="MyAnnotation.java Hello.java Aspect.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="'private String dummy [RuntimeVisibleAnnotations]' of type 'Hello' (Hello.java) has had @MyAnnotation field annotation removed by 'Aspect' (Aspect.java:3)"/> - <message kind="weave" text="'private String dummy [RuntimeVisibleAnnotations]' of type 'Hello' (Hello.java) is annotated with @MyAnnotation(dummy2 = "korte") field annotation from 'Aspect' (Aspect.java:4)"/> + <message kind="weave" text="'private String dummy [RuntimeVisibleAnnotations]' of type 'Hello' (Hello.java) is annotated with @MyAnnotation(dummy2 = "korte") field annotation from 'Aspect' (Aspect.java:4)"/> </compile> <run class="Hello"> <stdout> - <line text="@MyAnnotation(dummy1=, dummy2=korte)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="@MyAnnotation(dummy1="", dummy2="korte")" vm="9+"/> + <line text="@MyAnnotation(dummy1=, dummy2=korte)" vm="-1.8"/> + <line text="@MyAnnotation(dummy1="", dummy2="korte")" vm="9-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="bugs173/pr408014" title="inner interface mixin"> - <compile files="IdentifiableMixin.java" options="-1.5 -showWeaveInfo"> + <compile files="IdentifiableMixin.java" options="-1.5 -showWeaveInfo"> </compile> </ajc-test> - + <ajc-test dir="bugs173/pr407966" title="ordering"> <compile files="Aspect.aj Use.java Def.java" options="-1.5 -showWeaveInfo"> </compile> </ajc-test> <ajc-test dir="bugs173/pr407494" title="inner names"> - <compile files="A.java" options="-1.5 -showWeaveInfo"> + <compile files="A.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A$B.<clinit>())' in Type 'a.b.c.A$B' (A.java:4) advised by before advice from 'a.b.c.X' (A.java:13)"/> <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A.<clinit>())' in Type 'a.b.c.A' (A.java:3) advised by before advice from 'a.b.c.X' (A.java:13)"/> <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A$$C.<clinit>())' in Type 'a.b.c.A$$C' (A.java:6) advised by before advice from 'a.b.c.X' (A.java:13)"/> </compile> </ajc-test> - + <ajc-test dir="bugs173/pr407494" title="inner names 2"> - <compile files="A2.java" options="-1.5 -showWeaveInfo"> + <compile files="A2.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A$$B$$C.<clinit>())' in Type 'a.b.c.A$$B$$C' (A2.java:10) advised by before advice from 'a.b.c.X' (A2.java:14)"/> </compile> </ajc-test> - + <ajc-test dir="bugs173/pr405016/one" title="class anno value 1"> <compile files="Gimme.java Thingy.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Extending interface set for type 'Thingy' (Thingy.java) to include 'java.io.Serializable' (Thingy.java)"/> @@ -49,7 +49,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="bugs173/pr405016" title="class anno value"> <compile files="Gimme.java Thingy.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Extending interface set for type 'Thingy' (Thingy.java) to include 'java.io.Serializable' (Thingy.java)"/> @@ -60,7 +60,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="bugs173/pr404601" title="abstract method error"> <compile files="user/IUser.java user/Test.java user/UserTrait.java user/Youser.java" options="-1.5"> <message kind="error" text="private intertype declaration 'void UserTrait$I.testSetUsername(java.lang.String)' clashes with public member 'void Youser.testSetUsername(java.lang.String)'"/> @@ -74,13 +74,13 @@ <message kind="weave" text="Type 'Intface' (Code.java) has intertyped method from 'A' (Code.java:'void Intface.getName()')"/> </compile> </ajc-test> - + <ajc-test dir="bugs173/lyor/2" title="declare anno on itd 2"> <compile files="A1.java" outjar="aspects1.jar" options="-1.5 -Xlint:ignore"/> <compile files="Intface.java A2.java" aspectpath="aspects1.jar" outjar="aspects2.jar" options="-1.5"/> <compile files="Code.java" aspectpath="aspects1.jar;aspects2.jar" options="-1.5"/> - - <!-- + + <!-- <message kind="weave" text="'public void Intface.getName()' (A2.java) is annotated with @Foo method annotation from 'A1' (A1.java:7)"/> <message kind="weave" text="Type 'C' (Code.java) has intertyped method from 'A2' (A2.java:'void Intface.getName()')"/> <message kind="weave" text="Type 'Intface' (Code.java) has intertyped method from 'A2' (A2.java:'void Intface.getName()')"/> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc174/ajc174.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc174/ajc174.xml index 00a0166fa..39f694209 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc174/ajc174.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc174/ajc174.xml @@ -55,7 +55,7 @@ </stdout> </run> </ajc-test> - + <!-- declared with throws exception --> <ajc-test dir="bugs174/pr418129" title="annotated itd 2"> <compile files="Target2.java" options="-1.5 -showWeaveInfo"> @@ -69,7 +69,7 @@ </stdout> </run> </ajc-test> - + <!-- already annotated with another annotation --> <ajc-test dir="bugs174/pr418129" title="annotated itd 3"> <compile files="Target3.java" options="-1.5 -showWeaveInfo"> @@ -85,26 +85,26 @@ </stdout> </run> </ajc-test> - + <!-- already annotated with the same annotation --> <ajc-test dir="bugs174/pr418129" title="annotated itd 4"> <compile files="Target4.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Type 'Behavior' (Target4.java) has intertyped method from 'Trait' (Target4.java:'java.lang.String Behavior.hello()')"/> <message kind="weave" text="Type 'Target4' (Target4.java) has intertyped method from 'Trait' (Target4.java:'java.lang.String Behavior.hello()')"/> <!-- warning turned off as it gets confusing - when the itd on the interface is hit by a deca --> - <!-- + <!-- <message kind="warning" text="java.lang.String Target4.hello() - already has an annotation of type Tagged, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> --> </compile> <run class="Target4"> <stdout> <line text="1"/> - <line text="@Tagged(value=31)" vm="1.5,1.6,1.7,1.8,9,10,11,12,13"/> - <line text="@Tagged(31)" vm="14+"/> + <line text="@Tagged(value=31)" vm="1.5-13"/> + <line text="@Tagged(31)" vm="14-"/> </stdout> </run> </ajc-test> - + <ajc-test dir="bugs174/pr413378" title="super itd ctor"> <compile files="Code.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Type 'Child' (Code.java) has intertyped constructor from 'MyTest' (Code.java:'void Child.<init>(java.lang.String, int)')"/> @@ -116,7 +116,7 @@ </stdout> </run> </ajc-test> - + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 1"> <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> <compile files="Code.java" classpath="$sandbox/foo.jar"/> @@ -134,7 +134,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 2"> <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> <compile files="Code.java" classpath="$sandbox/foo.jar"/> @@ -153,7 +153,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 3"> <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> <compile files="Code.java" classpath="$sandbox/foo.jar"/> @@ -171,7 +171,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 4"> <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> <compile files="Code.java" classpath="$sandbox/foo.jar"/> @@ -190,7 +190,7 @@ </stderr> </run> </ajc-test> - + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 5"> <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> <compile files="Code.java" classpath="$sandbox/foo.jar"/> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc188/ajc188.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc188/ajc188.xml index 187fb50b3..8aa734e3e 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc188/ajc188.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc188/ajc188.xml @@ -8,10 +8,11 @@ <run class="AspectWithConstant"> <stdout> <line text="MAXS=hello"/> - <line text="@AspectWithConstant$Loggable()"/> + <line text="@AspectWithConstant$Loggable()" vm="-18"/> + <line text="@AspectWithConstant.Loggable()" vm="19-"/> </stdout></run> </ajc-test> - + <ajc-test dir="bugs188/484941" title="annotation discovery npe"> <compile files="Test2.java" options="-1.8 -XnoInline"/> </ajc-test> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190_from150.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190_from150.xml index 885a0b74e..dede00f0a 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190_from150.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190_from150.xml @@ -2750,8 +2750,8 @@ <line text="@target(Classified) at call(Class java.lang.Object.getClass())"/> <line text="1 @Foo()"/> <line text="1 @Foo()"/> - <line text="1 @Classified(classification=TOP-SECRET)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> - <line text="1 @Classified(classification="TOP-SECRET")" vm="9+"/> + <line text="1 @Classified(classification=TOP-SECRET)" vm="-1.8"/> + <line text="1 @Classified(classification="TOP-SECRET")" vm="9-"/> <line text="This information is TOP-SECRET"/> <line text="Entering critical join point with priority 3"/> <line text="Entering critical join point with reflectively obtained priority 3"/> @@ -3746,65 +3746,65 @@ <run class="GenericAspectRuntimePointcuts"> <stdout> <line text="target-ok an X execution(void X.foo())"/> - <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9-13"/> + <line text="@this-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9-13"/> + <line text="@target-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9-13"/> + <line text="@within-ok @MyAnnotation("my-value") execution(void X.foo())" vm="14-"/> <line text="cflow-ok an X a Y set(Y X.y)"/> - <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok-sub @MyAnnotation(value="bar") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok-sub @MyAnnotation("bar") execution(void X.bar())" vm="14+"/> - <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok @MyAnnotation(value="bar") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok @MyAnnotation("bar") execution(void X.bar())" vm="14+"/> + <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="bar") execution(void X.bar())" vm="9-13"/> + <line text="@annotation-ok-sub @MyAnnotation("bar") execution(void X.bar())" vm="14-"/> + <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok @MyAnnotation(value="bar") execution(void X.bar())" vm="9-13"/> + <line text="@annotation-ok @MyAnnotation("bar") execution(void X.bar())" vm="14-"/> <line text="target-ok an X execution(void X.bar())"/> - <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14+"/> - <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@args-ok @MyAnnotation(value="my-value") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@args-ok @MyAnnotation("my-value") execution(void Y.foo(X))" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9-13"/> + <line text="@this-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9-13"/> + <line text="@target-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9-13"/> + <line text="@within-ok @MyAnnotation("my-value") execution(void X.bar())" vm="14-"/> + <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@args-ok @MyAnnotation(value="my-value") execution(void Y.foo(X))" vm="9-13"/> + <line text="@args-ok @MyAnnotation("my-value") execution(void Y.foo(X))" vm="14-"/> <line text="args-ok an X execution(void Y.foo(X))"/> <line text="this-ok a Y execution(void Y.foo(X))"/> - <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14+"/> - <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok-sub @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok-sub @MyAnnotation("my-value") execution(X Y.bar())" vm="14+"/> - <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@annotation-ok @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@annotation-ok @MyAnnotation("my-value") execution(X Y.bar())" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9-13"/> + <line text="@this-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9-13"/> + <line text="@target-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9-13"/> + <line text="@within-ok @MyAnnotation("on Y") execution(void Y.foo(X))" vm="14-"/> + <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9-13"/> + <line text="@annotation-ok-sub @MyAnnotation("my-value") execution(X Y.bar())" vm="14-"/> + <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@annotation-ok @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9-13"/> + <line text="@annotation-ok @MyAnnotation("my-value") execution(X Y.bar())" vm="14-"/> <line text="this-ok a Y execution(X Y.bar())"/> - <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@this-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@this-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14+"/> - <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@target-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@target-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14+"/> - <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> - <line text="@within-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9,10,11,12,13"/> - <line text="@within-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14+"/> - <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5,1.6,1.7,1.8"/> - <line text="@withincode-ok @MyAnnotation(value="my-value") get(X Y.x)" vm="9,10,11,12,13"/> - <line text="@withincode-ok @MyAnnotation("my-value") get(X Y.x)" vm="14+"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9-13"/> + <line text="@this-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14-"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9-13"/> + <line text="@target-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14-"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5-1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9-13"/> + <line text="@within-ok @MyAnnotation("on Y") execution(X Y.bar())" vm="14-"/> + <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5-1.8"/> + <line text="@withincode-ok @MyAnnotation(value="my-value") get(X Y.x)" vm="9-13"/> + <line text="@withincode-ok @MyAnnotation("my-value") get(X Y.x)" vm="14-"/> </stdout> </run> </ajc-test> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml new file mode 100644 index 000000000..3741b338c --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml @@ -0,0 +1,169 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- + Java 19: no new final language features, only preview/incubator ones: + - "JEP 427: Pattern Matching for switch (Third Preview)" (syntax change, introducing 'when') + - "JEP 405: Record Patterns (Preview)" + - "JEP 425: Virtual Threads (Preview)" (API only) + - "JEP 428: Structured Concurrency (Incubator)" (API only) +--> +<suite> + + <!-- Java ?? final, Java 17, 18, 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="switch pattern matching preview 3 java"> + <compile files="SwitchPatternPreview3OK.java" options="--enable-preview -19" /> + <run class="SwitchPatternPreview3OK" vmargs="--enable-preview"> + <message></message> + <stdout> + <line text="null" /> + <line text="int 123" /> + <line text="long 999" /> + <line text="double 12.340000" /> + <line text="String foo" /> + <line text="[123, foo, 999, 12.34]" /> + <line text="Non-circle" /> + <line text="Small circle" /> + <line text="Large circle" /> + <line text="Sealed sub-class A" /> + <line text="Sealed sub-class B" /> + <line text="Sealed sub-record C" /> + <line text="absolute value 1: -1" /> + <line text="other integer: 0" /> + <line text="positive integer: 42" /> + <line text="other integer: -99" /> + <line text="positive integer: 123" /> + <line text="value unavailable: null" /> + </stdout> + </run> + </ajc-test> + + <!-- Java ?? final, Java 17, 18, 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="switch pattern matching preview 3 aspect"> + <compile files="SwitchPatternPreview3Aspect.aj" options="--enable-preview -19" /> + <run class="Application" vmargs="--enable-preview"> + <stdout> + <line text="null" /> + <line text="int 123" /> + <line text="long 999" /> + <line text="double 12.340000" /> + <line text="String foo" /> + <line text="[123, foo, 999, 12.34]" /> + <line text="Non-circle" /> + <line text="Small circle" /> + <line text="Large circle" /> + <line text="Sealed sub-class A" /> + <line text="Sealed sub-class B" /> + <line text="Sealed sub-record C" /> + <line text="absolute value 1: -1" /> + <line text="other integer: 0" /> + <line text="positive integer: 42" /> + <line text="other integer: -99" /> + <line text="positive integer: 123" /> + <line text="value unavailable: null" /> + </stdout> + </run> + </ajc-test> + + <!-- Java ?? final, Java 17, 18, 19 preview --> + <ajc-test dir="features198/java17" vm="19" title="switch pattern matching error"> + <compile files="SwitchPatternError.java" options="--enable-preview -19"> + <!-- TODO: Add correct compiler error message, as soon as JDT Core supports it --> + <message kind="error" file="SwitchPatternError.java" text="This case label is dominated by one of the preceding case label"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 17, 18, 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="switch pattern matching preview 3 error 1"> + <compile files="SwitchPatternPreview3Error1.java" options="--enable-preview -19"> + <!-- TODO: Add correct compiler error message, as soon as JDT Core supports it --> + <message kind="error" file="SwitchPatternPreview3Error1.java" text="This case label is dominated by one of the preceding case label"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 17, 18, 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="switch pattern matching preview 3 error 2"> + <compile files="SwitchPatternPreview3Error2.java" options="--enable-preview -19"> + <!-- TODO: Add correct compiler error message, as soon as JDT Core supports it --> + <message kind="error" file="SwitchPatternPreview3Error2.java" text="This case label is dominated by one of the preceding case label"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="record patterns"> + <compile files="RecordPatternsPreview1OK.java" options="--enable-preview -19"/> + </ajc-test> + + <!-- Java ?? final, Java 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="record patterns error"> + <compile files="RecordPatternsPreview1Error.java" options="--enable-preview -19"> + <message kind="error" file="RecordPatternsPreview1Error.java" text="Raw types are not allowed in record patterns"/> + <message kind="error" file="RecordPatternsPreview1Error.java" text="Raw types are not allowed in record patterns"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="record patterns exhaustiveness 1"> + <compile files="RecordPatternsPreview1ExhaustivenessOK1.java" options="--enable-preview -19"/> + <run class="RecordPatternsPreview1ExhaustivenessOK1" vmargs="--enable-preview"> + <stdout> + <line text="y"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <!-- Java ?? final, Java 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="record patterns exhaustiveness aspect"> + <compile files="RecordPatternsPreview1ExhaustivenessAspect.aj" options="--enable-preview -19"/> + <!-- + TODO: Remove redundant default clause when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + has been fixed. But even with the default clause, it generates wrong byte code and throws runtime error: + NoSuchMethodError: 'I Pair.x()' + --> + <!--run class="RecordPatternsPreview1ExhaustivenessAspect" vmargs="-XXX-enable-preview"> + <stdout> + <line text="y"/> + <line text="a"/> + <line text="Pair[x=C@000, y=D@000]"/> + </stdout> + </run--> + </ajc-test> + + <!-- Java ?? final, Java 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="record patterns aspect"> + <compile files="RecordPatternsPreview1Aspect.aj" options="--enable-preview -19"/> + <run class="RecordPatternsPreview1Aspect" vmargs="--enable-preview"> + <stdout> + <line text="9"/> + <line text="14"/> + <line text="Doing something with Point[x=2, y=7]"/> + <line text="Upper-left color: RED"/> + <line text="Upper-left color: RED"/> + <line text="Upper-left x coordinate: 1"/> + <line text="Doing something with Rectangle[upperLeft=ColoredPoint[p=Point[x=1, y=6], c=RED], lowerRight=ColoredPoint[p=Point[x=4, y=6], c=BLUE]]"/> + </stdout> + </run> + </ajc-test> + + <!-- Java ?? final, Java 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="record patterns exhaustiveness error"> + <compile files="RecordPatternsPreview1ExhaustivenessError.java" options="--enable-preview -19"> + <message kind="error" file="RecordPatternsPreview1ExhaustivenessError.java" text="An enhanced switch statement should be exhaustive; a default label expected"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 19 preview --> + <ajc-test dir="features1919/java19" vm="19" title="record patterns exhaustiveness 2"> + <compile files="RecordPatternsPreview1ExhaustivenessOK2.java" options="--enable-preview -19"/> + <run class="RecordPatternsPreview1ExhaustivenessOK2" vmargs="--enable-preview"> + <stdout> + <line text="Bob 12"/> + </stdout> + </run> + </ajc-test> + + <!-- Currently, there are no bugfixes with tests in this AspectJ vesion --> + <ajc-test dir="bugs1919/github_99999" vm="19" title="dummy Java 19"> + </ajc-test> + +</suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/sanity-tests-19.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/sanity-tests-19.xml new file mode 100644 index 000000000..25df39e53 --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/sanity-tests-19.xml @@ -0,0 +1,70 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-19"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-19"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-19"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-19"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-19"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-19"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-19"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-19"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-19"/> + </ajc-test> + + <!-- check class file version is 63.0 (Java 19) --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-19"/> + </ajc-test> + + <!-- check class file version is 63.0 (Java 19) --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 19"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-19"/> + </ajc-test> + +</suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml index 7c38db68e..5488671f5 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml @@ -3,10 +3,6 @@ <suite> - <!-- Java 18 final: no new features, only 2nd preview for "JEP 420: Pattern Matching for switch (Second Preview)" --> - <ajc-test dir="features199/java18" vm="18" title="dummy Java 18"> - </ajc-test> - <!-- Java ?? final, Java 17, 18 preview --> <ajc-test dir="features198/java17" vm="18" title="switch pattern matching error"> <compile files="SwitchPatternError.java" options="--enable-preview -18"> diff --git a/util/pom.xml b/util/pom.xml index ca3e31e75..0866d18e3 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>util</artifactId> diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java index d916002b6..7151c092b 100644 --- a/util/src/main/java/org/aspectj/util/LangUtil.java +++ b/util/src/main/java/org/aspectj/util/LangUtil.java @@ -57,6 +57,8 @@ public class LangUtil { static { // http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html // http://openjdk.java.net/jeps/223 "New Version-String Scheme" + // TODO: Use java.lang.Runtime class (since Java 9, now AspectJ needs Java 11+ due to JDT Core anyway) + final String JAVA_VERSION_NOT_FOUND = "System properties appear damaged, cannot find: java.version/java.runtime.version/java.vm.version"; try { String vm = System.getProperty("java.version"); // JLS 20.18.7 if (vm == null) { @@ -66,15 +68,12 @@ public class LangUtil { vm = System.getProperty("java.vm.version"); } if (vm == null) { - new RuntimeException( - "System properties appear damaged, cannot find: java.version/java.runtime.version/java.vm.version") - .printStackTrace(System.err); + new RuntimeException(JAVA_VERSION_NOT_FOUND).printStackTrace(System.err); vmVersion = 1.5; } else { - // Version: [1-9][0-9]*((\.0)*\.[1-9][0-9]*)* // Care about the first set of digits and second set if first digit is 1 try { - List<Integer> numbers = getFirstNumbers(vm); + List<Integer> numbers = getJavaMajorMinor(vm); if (numbers.get(0) == 1) { // Old school for 1.0 > 1.8 vmVersion = numbers.get(0)+(numbers.get(1)/10d); @@ -89,16 +88,15 @@ public class LangUtil { } } } catch (Throwable t) { - new RuntimeException( - "System properties appear damaged, cannot find: java.version/java.runtime.version/java.vm.version", t) - .printStackTrace(System.err); + new RuntimeException(JAVA_VERSION_NOT_FOUND, t).printStackTrace(System.err); vmVersion = 1.5; } } - private static List<Integer> getFirstNumbers(String vm) { + private static List<Integer> getJavaMajorMinor(String vm) { List<Integer> result = new ArrayList<>(); - StringTokenizer st = new StringTokenizer(vm,".-_"); + // Can be something like '1.5', '11.0.16.1', '19+36-2238' + StringTokenizer st = new StringTokenizer(vm.replaceFirst("[+].*", ""), ".-_"); try { result.add(Integer.parseInt(st.nextToken())); result.add(Integer.parseInt(st.nextToken())); @@ -106,6 +104,9 @@ public class LangUtil { // NoSuchElementException if no more tokens // NumberFormatException if not a number } + // Always add a default minor, just in case a caller expects it + if (result.size() == 1) + result.add(0); return result; } @@ -182,6 +183,10 @@ public class LangUtil { return 19 <= vmVersion; } + public static boolean is20VMOrGreater() { + return 20 <= vmVersion; + } + /** * Shorthand for "if null, throw IllegalArgumentException" * diff --git a/weaver/pom.xml b/weaver/pom.xml index 966f6791a..d6e839313 100644 --- a/weaver/pom.xml +++ b/weaver/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.10-SNAPSHOT</version> + <version>1.9.19-SNAPSHOT</version> </parent> <artifactId>weaver</artifactId> |