From c540b0f60ef5e46b33cad1b23c36d1c51af82aef Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Sat, 1 Oct 2022 17:51:45 +0200
Subject: [PATCH 01/15] First Java 19 version, barely tested.
Signed-off-by: Alexander Kriegisch
---
.../ajdt/internal/core/builder/AjBuildNotifier.java | 7 ++++---
.../aspectj/ajdt/internal/core/builder/AspectJBuilder.java | 5 +++--
pom.xml | 4 ++--
.../main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java | 6 +++---
util/src/main/java/org/aspectj/util/LangUtil.java | 4 ++++
5 files changed, 16 insertions(+), 10 deletions(-)
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 1a82cb6a01..53fb5750c5 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 6435903c8d..f352a76907 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.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 ICompilerAdapter getAdapter(Compiler forCompiler) {
* @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/pom.xml b/pom.xml
index 07777058ce..41805cbf8e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,8 +21,8 @@
true
- 1.9.9.1
- 9.2
+ 1.9.10-SNAPSHOT
+ 9.31.6.32.6.21.2
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 650fdc4e58..dc83ed7fab 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 String toString() {
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/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java
index d916002b69..944e95040d 100644
--- a/util/src/main/java/org/aspectj/util/LangUtil.java
+++ b/util/src/main/java/org/aspectj/util/LangUtil.java
@@ -182,6 +182,10 @@ public static boolean is19VMOrGreater() {
return 19 <= vmVersion;
}
+ public static boolean is20VMOrGreater() {
+ return 20 <= vmVersion;
+ }
+
/**
* Shorthand for "if null, throw IllegalArgumentException"
*
From 15cef016830bc16c7c51afd41782f6ac061bfae5 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Sun, 2 Oct 2022 12:11:43 +0200
Subject: [PATCH 02/15] Set Java 19 compiler version after JDT Core merge
In messages_aspectj.properties, set compiler.version to
"Eclipse Compiler 5fd28398cc7aba (21Sep2022) - Java19".
Signed-off-by: Alexander Kriegisch
---
.../jdt/internal/compiler/batch/messages_aspectj.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 23bd98c021..f4831346b4 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 5fd28398cc7aba (21Sep2022) - Java19
compiler.copyright =
misc.version = {0} {1} - {2} {3}
From dc2863a18e0547bad726f12755f6418c389b5613 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Sun, 2 Oct 2022 12:36:17 +0200
Subject: [PATCH 03/15] Set Maven version to 1.9.19-SNAPSHOT
It makes sense to indicate the Java version in the minor-minor of
AspectJ artifacts.
Signed-off-by: Alexander Kriegisch
---
ajde.core/pom.xml | 2 +-
ajde/pom.xml | 2 +-
ajdoc/pom.xml | 2 +-
asm/pom.xml | 2 +-
aspectjmatcher/pom.xml | 2 +-
aspectjrt/pom.xml | 2 +-
aspectjtools/pom.xml | 2 +-
aspectjweaver/pom.xml | 2 +-
bcel-builder/pom.xml | 2 +-
bridge/pom.xml | 2 +-
build/pom.xml | 2 +-
docs/pom.xml | 2 +-
installer/pom.xml | 2 +-
lib/pom.xml | 2 +-
loadtime/pom.xml | 2 +-
org.aspectj.ajdt.core/pom.xml | 2 +-
org.aspectj.matcher/pom.xml | 2 +-
pom.xml | 4 ++--
run-all-junit-tests/pom.xml | 2 +-
runtime/pom.xml | 2 +-
taskdefs/pom.xml | 2 +-
testing-client/pom.xml | 2 +-
testing-drivers/pom.xml | 2 +-
testing-util/pom.xml | 2 +-
testing/pom.xml | 2 +-
tests/pom.xml | 2 +-
util/pom.xml | 2 +-
weaver/pom.xml | 2 +-
28 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/ajde.core/pom.xml b/ajde.core/pom.xml
index eefb3a411c..9de1dd3133 100644
--- a/ajde.core/pom.xml
+++ b/ajde.core/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTajde.core
diff --git a/ajde/pom.xml b/ajde/pom.xml
index 51679ae2d7..948492f96d 100644
--- a/ajde/pom.xml
+++ b/ajde/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTajde
diff --git a/ajdoc/pom.xml b/ajdoc/pom.xml
index 50922a65c4..9ab6304dfd 100644
--- a/ajdoc/pom.xml
+++ b/ajdoc/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTajdoc
diff --git a/asm/pom.xml b/asm/pom.xml
index ff1bdc1edc..02229d0d0d 100644
--- a/asm/pom.xml
+++ b/asm/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTasm
diff --git a/aspectjmatcher/pom.xml b/aspectjmatcher/pom.xml
index f707b22e61..9f664c0bde 100644
--- a/aspectjmatcher/pom.xml
+++ b/aspectjmatcher/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTaspectjmatcher
diff --git a/aspectjrt/pom.xml b/aspectjrt/pom.xml
index 22a47dd293..09e67eef04 100644
--- a/aspectjrt/pom.xml
+++ b/aspectjrt/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTaspectjrt
diff --git a/aspectjtools/pom.xml b/aspectjtools/pom.xml
index 3c6f708d35..eb9300e31b 100644
--- a/aspectjtools/pom.xml
+++ b/aspectjtools/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTaspectjtools
diff --git a/aspectjweaver/pom.xml b/aspectjweaver/pom.xml
index a173b769c9..09dfb01a93 100644
--- a/aspectjweaver/pom.xml
+++ b/aspectjweaver/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTaspectjweaver
diff --git a/bcel-builder/pom.xml b/bcel-builder/pom.xml
index f2f8ca305a..d8eb96943c 100644
--- a/bcel-builder/pom.xml
+++ b/bcel-builder/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTbcel-builder
diff --git a/bridge/pom.xml b/bridge/pom.xml
index 20411313cb..fcbc63e006 100644
--- a/bridge/pom.xml
+++ b/bridge/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTbridge
diff --git a/build/pom.xml b/build/pom.xml
index 23ae6dd979..cb2fb7456f 100644
--- a/build/pom.xml
+++ b/build/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTbuild
diff --git a/docs/pom.xml b/docs/pom.xml
index 39a7c0f7f0..30c0c2f689 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -5,7 +5,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTdocs
diff --git a/installer/pom.xml b/installer/pom.xml
index 499c48f161..a9474926c5 100644
--- a/installer/pom.xml
+++ b/installer/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTinstaller
diff --git a/lib/pom.xml b/lib/pom.xml
index 712df99053..eb26770dbe 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -7,7 +7,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTlib
diff --git a/loadtime/pom.xml b/loadtime/pom.xml
index c940bab301..0a759d23b3 100644
--- a/loadtime/pom.xml
+++ b/loadtime/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTloadtime
diff --git a/org.aspectj.ajdt.core/pom.xml b/org.aspectj.ajdt.core/pom.xml
index 37b5fb181c..b3a358989f 100644
--- a/org.aspectj.ajdt.core/pom.xml
+++ b/org.aspectj.ajdt.core/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTorg.aspectj.ajdt.core
diff --git a/org.aspectj.matcher/pom.xml b/org.aspectj.matcher/pom.xml
index bc4ac7896d..1af71688be 100644
--- a/org.aspectj.matcher/pom.xml
+++ b/org.aspectj.matcher/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTorg.aspectj.matcher
diff --git a/pom.xml b/pom.xml
index 41805cbf8e..f93fcc1bf0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTpomAspectJ Parent Project
@@ -21,7 +21,7 @@
true
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOT9.31.6.32.6.2
diff --git a/run-all-junit-tests/pom.xml b/run-all-junit-tests/pom.xml
index 30df18d382..b636018c2b 100644
--- a/run-all-junit-tests/pom.xml
+++ b/run-all-junit-tests/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTrun-all-junit-tests
diff --git a/runtime/pom.xml b/runtime/pom.xml
index e669549330..1da7e877ef 100644
--- a/runtime/pom.xml
+++ b/runtime/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTruntime
diff --git a/taskdefs/pom.xml b/taskdefs/pom.xml
index 55f5436e05..d923446ad7 100644
--- a/taskdefs/pom.xml
+++ b/taskdefs/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTtaskdefs
diff --git a/testing-client/pom.xml b/testing-client/pom.xml
index 864dac12ca..2e2ea723ca 100644
--- a/testing-client/pom.xml
+++ b/testing-client/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTtesting-client
diff --git a/testing-drivers/pom.xml b/testing-drivers/pom.xml
index 30b75c3ca9..08c7cf38d6 100644
--- a/testing-drivers/pom.xml
+++ b/testing-drivers/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTtesting-drivers
diff --git a/testing-util/pom.xml b/testing-util/pom.xml
index a596d0c99a..a0866689e8 100644
--- a/testing-util/pom.xml
+++ b/testing-util/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTtesting-util
diff --git a/testing/pom.xml b/testing/pom.xml
index ae7fd0d9a4..a1ff200563 100644
--- a/testing/pom.xml
+++ b/testing/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTtesting
diff --git a/tests/pom.xml b/tests/pom.xml
index 7b5e400bdc..d767dcebc3 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTtests
diff --git a/util/pom.xml b/util/pom.xml
index ca3e31e75e..0866d18e38 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTutil
diff --git a/weaver/pom.xml b/weaver/pom.xml
index 966f6791a1..d6e8393136 100644
--- a/weaver/pom.xml
+++ b/weaver/pom.xml
@@ -6,7 +6,7 @@
org.aspectjaspectj-parent
- 1.9.10-SNAPSHOT
+ 1.9.19-SNAPSHOTweaver
From c05db1e68c0f268641612403d1069e0f97beed59 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Sun, 2 Oct 2022 17:38:27 +0200
Subject: [PATCH 04/15] Bump ASM to 9.4, supporting Java 20 class files
Even though we just upgraded to 9.3 for Java 19, it does not hurt to
have ASM recognise the Java 20 class file major version.
Signed-off-by: Alexander Kriegisch
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index f93fcc1bf0..4c4b722413 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
1.9.19-SNAPSHOT
- 9.3
+ 9.41.6.32.6.21.2
From 6bffb284511bd7b4153e8c578076c83c38cb01db Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Mon, 3 Oct 2022 12:53:33 +0200
Subject: [PATCH 05/15] Do not run Java 18 preview feature tests with Java 19
JDT Core
Signed-off-by: Alexander Kriegisch
---
.../org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java
index ba4d006058..d79229c1b0 100644
--- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java
@@ -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 void setUp() throws Exception {
);
}
super.setUp();
+ */
}
}
From d2b81de3244d47476923be07f1f822e5ccb7cb98 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Mon, 3 Oct 2022 12:55:38 +0200
Subject: [PATCH 06/15] Cosmetic fixes in Java 18 tests (e.g. copyright year
2022)
Signed-off-by: Alexander Kriegisch
---
.../org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java | 2 +-
.../aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java | 2 +-
.../java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java | 4 ++--
.../org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java | 2 +-
.../test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java | 2 +-
.../aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java | 2 +-
.../java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java | 4 ++--
.../test/resources/org/aspectj/systemtest/ajc199/ajc199.xml | 4 ----
8 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java
index d79229c1b0..fade6c92fe 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
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java
index 9b9efdd34b..20e26862f8 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/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java
index 7040deba42..2b3ad813a0 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 @@
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 9cb01eec8f..6ff7adee40 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
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 5b2087ed21..9d1dc6c6d9 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 dbe6f733af..8afe68946f 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 d86e11454f..2fd9d2660a 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 @@
/*
* 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/resources/org/aspectj/systemtest/ajc199/ajc199.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml
index 7c38db68e5..5488671f55 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 @@
-
-
-
-
From 7ef7cd245b2d62581d67c122a95cb29d8b0dbb76 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Mon, 3 Oct 2022 14:02:32 +0200
Subject: [PATCH 07/15] Remove Batik path entries from test classpath
Firstly, Batik is not needed for running AspectJ tests.
Secondly, the fixed Windows path separators led to GitHub CI/CD tests
failing under Java 18+ on GitHub. Replacing ';' by 'File.pathSeparator'
would have fixed the problem, but removing the paths altogether is the
cleaner solution.
Signed-off-by: Alexander Kriegisch
---
.../tools/MultiProjTestCompilerConfiguration.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
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 5a3cab221f..52602114ed 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 String getClasspath() {
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;
From 2548a8ab0b3649ed3fc8eac331ebeb1f28f02c3d Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Mon, 3 Oct 2022 16:36:33 +0200
Subject: [PATCH 08/15] Deactivate Java 18 preview language feature tests
and enable LangUtil to parse Java versions like '19+36-2238'.
Signed-off-by: Alexander Kriegisch
---
.../systemtest/ajc196/AllTestsAspectJ196.java | 2 +-
.../systemtest/ajc199/AllTestsAspectJ199.java | 3 +++
.../main/java/org/aspectj/util/LangUtil.java | 20 +++++++++----------
3 files changed, 14 insertions(+), 11 deletions(-)
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 c2e13b550e..d3cbfb9ab9 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 static Test suite() {
// 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/AllTestsAspectJ199.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java
index 6ff7adee40..6b77073bea 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java
@@ -23,9 +23,12 @@ public static Test suite() {
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/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java
index 944e95040d..02aa7d94b3 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 static double getVmVersion() {
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 static double getVmVersion() {
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 numbers = getFirstNumbers(vm);
+ List numbers = getJavaMajorMinor(vm);
if (numbers.get(0) == 1) {
// Old school for 1.0 > 1.8
vmVersion = numbers.get(0)+(numbers.get(1)/10d);
@@ -89,18 +88,19 @@ public static double getVmVersion() {
}
}
} 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 getFirstNumbers(String vm) {
+ private static List getJavaMajorMinor(String vm) {
List 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,".-_+");
try {
result.add(Integer.parseInt(st.nextToken()));
+ // FIXME: The minor will be wrong for version strings like '19+36-2238'.
+ // The minor is only relevant for Java <= 1.8. Even so, this is super ugly.
result.add(Integer.parseInt(st.nextToken()));
} catch (Exception e) {
// NoSuchElementException if no more tokens
From ec67725ea41ae69453d4ee2624b311746aab3c26 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Mon, 3 Oct 2022 17:17:50 +0200
Subject: [PATCH 09/15] Add the first few Java 19 tests
For now, only the "pattern matching for switch" tests from previews 1
and 2 were adjusted to work in preview 3, because guarded patterns were
replaced by 'when' clauses in 'switch' blocks. Therefore, existing test
classes did not compile anymore and had to be replaced by syntactically
upgraded versions with content merged from preview 1 and 2 classes.
Signed-off-by: Alexander Kriegisch
---
.github/workflows/maven.yml | 2 +-
.../org/aspectj/apache/bcel/Constants.java | 6 +-
.../XMLBasedAjcTestCaseForJava19Only.java | 40 ++++
.../XMLBasedAjcTestCaseForJava19OrLater.java | 27 +++
.../java19/SwitchPatternPreview3Aspect.aj | 88 +++++++++
.../java19/SwitchPatternPreview3Error1.java | 13 ++
.../java19/SwitchPatternPreview3Error2.java | 21 +++
.../java19/SwitchPatternPreview3OK.java | 172 ++++++++++++++++++
.../org/aspectj/systemtest/AllTests19.java | 2 +
.../systemtest/ajc1919/Ajc1919TestsJava.java | 32 ++++
.../ajc1919/AllTestsAspectJ1919.java | 33 ++++
.../systemtest/ajc1919/Bugs1919Tests.java | 31 ++++
.../ajc1919/Java19PreviewFeaturesTests.java | 54 ++++++
.../systemtest/ajc1919/SanityTestsJava19.java | 87 +++++++++
.../aspectj/systemtest/ajc1919/ajc1919.xml | 95 ++++++++++
.../systemtest/ajc1919/sanity-tests-19.xml | 70 +++++++
16 files changed, 770 insertions(+), 3 deletions(-)
create mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java
create mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java
create mode 100644 tests/features1919/java19/SwitchPatternPreview3Aspect.aj
create mode 100644 tests/features1919/java19/SwitchPatternPreview3Error1.java
create mode 100644 tests/features1919/java19/SwitchPatternPreview3Error2.java
create mode 100644 tests/features1919/java19/SwitchPatternPreview3OK.java
create mode 100644 tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java
create mode 100644 tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java
create mode 100644 tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
create mode 100644 tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java
create mode 100644 tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java
create mode 100644 tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
create mode 100644 tests/src/test/resources/org/aspectj/systemtest/ajc1919/sanity-tests-19.xml
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index b8fbbf386c..c1bf1b3bf4 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/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java
index 6c2240b9de..87c36f2ffe 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/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java
new file mode 100644
index 0000000000..e0a99283d3
--- /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 0000000000..95beffef53
--- /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/SwitchPatternPreview3Aspect.aj b/tests/features1919/java19/SwitchPatternPreview3Aspect.aj
new file mode 100644
index 0000000000..ae147dad7c
--- /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 0000000000..5f3895cc32
--- /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 0000000000..c02c4d3cc7
--- /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 0000000000..7060ec0c25
--- /dev/null
+++ b/tests/features1919/java19/SwitchPatternPreview3OK.java
@@ -0,0 +1,172 @@
+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()));
+ }
+
+ 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, and it does with Javac, but not with ECJ.
+ *
+ * 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.
+ */
+ /*
+ sealed interface I permits A, B {}
+ final static class A implements I {}
+ final static class B implements I {}
+
+ static int testGenericSealedExhaustive(I i) {
+ return switch (i) {
+ // Exhaustive as no A case possible!
+ case B bi -> 42;
+ };
+ }
+ */
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java
index d14bc54cb5..21ad9de901 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 @@
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 static Test suite() {
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 0000000000..5f471490d6
--- /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 0000000000..da1a81f976
--- /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 0000000000..38441267ef
--- /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 0000000000..39f9019f45
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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 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 0000000000..fa2abafe5a
--- /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/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
new file mode 100644
index 0000000000..9adc98bca4
--- /dev/null
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 0000000000..25df39e535
--- /dev/null
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/sanity-tests-19.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 8cbfedcde9cda3f09784ff7fae2b1981154e0488 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Mon, 3 Oct 2022 21:51:31 +0200
Subject: [PATCH 10/15] Fix tests due to changed JDK 'toString' methods in Java
19
Signed-off-by: Alexander Kriegisch
---
.../aspectj/systemtest/ajc1612/ajc1612.xml | 3 +-
.../aspectj/systemtest/ajc169/intertype.xml | 85 ++++++++++---------
.../org/aspectj/systemtest/ajc188/ajc188.xml | 5 +-
3 files changed, 51 insertions(+), 42 deletions(-)
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 650bdea43a..838003df58 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 @@
-
+
+
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 185e3084c4..5bb0155d35 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 @@
-
+
@@ -11,7 +11,7 @@
-
+
@@ -28,7 +28,7 @@
-
+
@@ -37,7 +37,7 @@
-
+
@@ -46,7 +46,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
@@ -64,7 +64,7 @@
-
+
@@ -72,11 +72,12 @@
-
+
+
-
+
@@ -84,11 +85,12 @@
-
+
+
-
+
@@ -96,11 +98,12 @@
-
+
+
-
+
@@ -108,11 +111,12 @@
-
+
+
-
+
@@ -120,11 +124,12 @@
-
+
+
-
+
@@ -132,11 +137,12 @@
-
+
+
-
+
@@ -144,11 +150,12 @@
-
+
+
-
+
@@ -157,12 +164,12 @@
-
+
-
+
@@ -172,7 +179,7 @@
-
+
@@ -180,17 +187,17 @@
-
+
-
+
-
+
@@ -198,7 +205,7 @@
-
+
@@ -206,7 +213,7 @@
-
+
@@ -214,43 +221,43 @@
-
+
-
+
-
+
-
+
-
-
-
-
\ No newline at end of file
+
+
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 187fb50b32..7e7f9ba71d 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 @@
-
+
+
-
+
From 0ff75f28fe7a0b7b4757c02b533704354c1dd46c Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Wed, 5 Oct 2022 10:11:54 +0200
Subject: [PATCH 11/15] LangUtil: improve Java version major/minor parsing
- Ignore everything including and after '+' in versions like '19+36-2238'
- Add minor '.0' to Java versions like '19', '19+36-2238'
Signed-off-by: Alexander Kriegisch
---
util/src/main/java/org/aspectj/util/LangUtil.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java
index 02aa7d94b3..7151c092b4 100644
--- a/util/src/main/java/org/aspectj/util/LangUtil.java
+++ b/util/src/main/java/org/aspectj/util/LangUtil.java
@@ -96,16 +96,17 @@ public static double getVmVersion() {
private static List getJavaMajorMinor(String vm) {
List result = new ArrayList<>();
// Can be something like '1.5', '11.0.16.1', '19+36-2238'
- StringTokenizer st = new StringTokenizer(vm,".-_+");
+ StringTokenizer st = new StringTokenizer(vm.replaceFirst("[+].*", ""), ".-_");
try {
result.add(Integer.parseInt(st.nextToken()));
- // FIXME: The minor will be wrong for version strings like '19+36-2238'.
- // The minor is only relevant for Java <= 1.8. Even so, this is super ugly.
result.add(Integer.parseInt(st.nextToken()));
} catch (Exception e) {
// 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;
}
From c84a35837e194f5ac8f38cee2998afb5ec631078 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Wed, 5 Oct 2022 17:37:21 +0200
Subject: [PATCH 12/15] OutputSpec.matchesThisVm better supports version ranges
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.
Existing XML test specs using '
have been adjusted to use version ranges rather than long lists of
consecutive versions. Furthermore, ranges with a trailing '+' like '14+'
were replaced by using the new canonical format '14-', even though the
parser still correctly recognises '14+'.
Signed-off-by: Alexander Kriegisch
---
.../java/org/aspectj/testing/OutputSpec.java | 47 ++++----
.../org/aspectj/systemtest/ajc150/ajc150.xml | 112 +++++++++---------
.../org/aspectj/systemtest/ajc151/ajc151.xml | 106 ++++++++---------
.../org/aspectj/systemtest/ajc154/ajc154.xml | 24 ++--
.../systemtest/ajc1611/newfeatures-tests.xml | 28 ++---
.../aspectj/systemtest/ajc1612/ajc1612.xml | 12 +-
.../aspectj/systemtest/ajc169/intertype.xml | 56 ++++-----
.../org/aspectj/systemtest/ajc170/ajc170.xml | 36 +++---
.../org/aspectj/systemtest/ajc173/ajc173.xml | 30 ++---
.../org/aspectj/systemtest/ajc174/ajc174.xml | 24 ++--
.../org/aspectj/systemtest/ajc188/ajc188.xml | 4 +-
.../systemtest/ajc190/ajc190_from150.xml | 112 +++++++++---------
12 files changed, 298 insertions(+), 293 deletions(-)
diff --git a/testing/src/test/java/org/aspectj/testing/OutputSpec.java b/testing/src/test/java/org/aspectj/testing/OutputSpec.java
index 5a6594756f..14fc3bb621 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 org.aspectj.tools.ajc.AjcTestCase;
import org.aspectj.util.LangUtil;
+import static java.lang.Double.parseDouble;
+
public class OutputSpec {
private List expectedOutputLines = new ArrayList<>();
@@ -28,28 +30,31 @@ public void addLine(OutputLine line) {
}
/**
- * 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/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml
index 7963070e0e..63313f6240 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 @@
-
-
+
+
@@ -3746,65 +3746,65 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
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 8d8cd66b84..3588f5950a 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 @@
-
+
@@ -20,7 +20,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
@@ -53,7 +53,7 @@
-
+
@@ -70,7 +70,7 @@
-
+
@@ -92,22 +92,22 @@
-
-
-
-
+
+
+
+
-
+
-
-
-
-
+
+
+
+
@@ -120,23 +120,23 @@
-
+
-
+
-
-
+
+
-
-
+
+
@@ -153,7 +153,7 @@
-
+
@@ -167,19 +167,19 @@
-
+
-
-
+
+
-
-
+
+
-
+
@@ -191,32 +191,32 @@
-
+
-
-
+
+
-
+
-
+
-
+
-
+
@@ -227,7 +227,7 @@
-
+
@@ -239,7 +239,7 @@
-
+
@@ -248,12 +248,12 @@
-
+
-
+
@@ -264,7 +264,7 @@
-
+
@@ -272,18 +272,18 @@
-
+
-
+
-
+
@@ -292,11 +292,11 @@
-
+
-
+
@@ -307,7 +307,7 @@
-
+
@@ -317,7 +317,7 @@
-
+
@@ -345,7 +345,7 @@
-
+
@@ -379,7 +379,7 @@
-
+
@@ -390,10 +390,10 @@
-
+
-
+
@@ -403,8 +403,8 @@
-
-
+
+
@@ -415,4 +415,4 @@
-
\ No newline at end of file
+
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 a0d38cb6cc..8ed8e3ffce 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 @@
-
-
+
+
@@ -40,8 +40,8 @@
-
-
+
+
@@ -53,8 +53,8 @@
-
-
+
+
@@ -66,8 +66,8 @@
-
-
+
+
@@ -80,8 +80,8 @@
-
-
+
+
@@ -95,8 +95,8 @@
-
-
+
+
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 9140426333..86e1359792 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 @@
-
+
@@ -34,8 +34,8 @@
-
-
+
+
@@ -50,14 +50,14 @@
-
+
-
+
@@ -65,7 +65,7 @@
-
+
@@ -74,7 +74,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
@@ -103,18 +103,18 @@
-
+
-
-
+
+
-
+
@@ -122,7 +122,7 @@
-
+
@@ -135,5 +135,5 @@
-
+
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 838003df58..d7423a194c 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml
@@ -7,8 +7,8 @@
-
-
+
+
@@ -258,10 +258,10 @@
-
-
-
-
+
+
+
+
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 5bb0155d35..e4dbec2fa4 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc169/intertype.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc169/intertype.xml
@@ -70,10 +70,10 @@
-
-
-
-
+
+
+
+
@@ -83,10 +83,10 @@
-
-
-
-
+
+
+
+
@@ -96,10 +96,10 @@
-
-
-
-
+
+
+
+
@@ -109,10 +109,10 @@
-
-
-
-
+
+
+
+
@@ -122,10 +122,10 @@
-
-
-
-
+
+
+
+
@@ -135,10 +135,10 @@
-
-
-
-
+
+
+
+
@@ -148,10 +148,10 @@
-
-
-
-
+
+
+
+
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 f3f18f6d95..5fe1c9ffa7 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 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
@@ -202,16 +202,16 @@
-
-
+
+
-
-
+
+
-
-
+
+
@@ -223,8 +223,8 @@
-
-
+
+
@@ -235,8 +235,8 @@
-
-
+
+
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 398fae62fb..a60fca98cf 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 @@
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -49,7 +49,7 @@
-
+
@@ -60,7 +60,7 @@
-
+
@@ -74,13 +74,13 @@
-
+
-
-
@@ -69,7 +69,7 @@
-
+
@@ -85,26 +85,26 @@
-
+
-
-
-
+
+
-
+
@@ -116,7 +116,7 @@
-
+
@@ -134,7 +134,7 @@
-
+
@@ -153,7 +153,7 @@
-
+
@@ -171,7 +171,7 @@
-
+
@@ -190,7 +190,7 @@
-
+
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 7e7f9ba71d..8aa734e3e7 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc188/ajc188.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc188/ajc188.xml
@@ -8,8 +8,8 @@
-
-
+
+
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 885a0b74e7..dede00f0a3 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 @@
-
-
+
+
@@ -3746,65 +3746,65 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
From 9be61fe259dfd3340050f0c4d80ee9e9555583e1 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Tue, 20 Dec 2022 13:06:56 +0100
Subject: [PATCH 13/15] Bump ECJ version in messages_aspectj.properties
Eclipse Compiler 19f448f47c9e3e (15Dec2022) - Java19
Signed-off-by: Alexander Kriegisch
---
.../jdt/internal/compiler/batch/messages_aspectj.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 f4831346b4..d837c76dce 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 5fd28398cc7aba (21Sep2022) - Java19
+compiler.version = Eclipse Compiler 19f448f47c9e3e (15Dec2022) - Java19
compiler.copyright =
misc.version = {0} {1} - {2} {3}
From 5239ae0480d4f623aa9c9491b6bf75e3e568cc89 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Wed, 21 Dec 2022 12:57:44 +0100
Subject: [PATCH 14/15] Add tests for Java 19 record patterns
Signed-off-by: Alexander Kriegisch
---
.../java19/RecordPatternsPreview1Aspect.aj | 35 +++++++++
.../java19/RecordPatternsPreview1Error.java | 24 ++++++
...ordPatternsPreview1ExhaustivenessAspect.aj | 37 +++++++++
...rdPatternsPreview1ExhaustivenessError.java | 22 ++++++
...cordPatternsPreview1ExhaustivenessOK1.java | 28 +++++++
...cordPatternsPreview1ExhaustivenessOK2.java | 10 +++
.../java19/RecordPatternsPreview1OK.java | 15 ++++
.../java19/SwitchPatternPreview3OK.java | 6 +-
.../java18/SwitchPatternPreview2OK.java | 6 +-
.../ajc1919/Java19PreviewFeaturesTests.java | 43 ++++++++++
.../aspectj/systemtest/ajc1919/ajc1919.xml | 78 ++++++++++++++++++-
11 files changed, 297 insertions(+), 7 deletions(-)
create mode 100644 tests/features1919/java19/RecordPatternsPreview1Aspect.aj
create mode 100644 tests/features1919/java19/RecordPatternsPreview1Error.java
create mode 100644 tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj
create mode 100644 tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java
create mode 100644 tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK1.java
create mode 100644 tests/features1919/java19/RecordPatternsPreview1ExhaustivenessOK2.java
create mode 100644 tests/features1919/java19/RecordPatternsPreview1OK.java
diff --git a/tests/features1919/java19/RecordPatternsPreview1Aspect.aj b/tests/features1919/java19/RecordPatternsPreview1Aspect.aj
new file mode 100644
index 0000000000..20f6a54e50
--- /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 0000000000..2a5038e898
--- /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
+
+
New features
+
+
+ AspectJ 1.9.19 supports Java 19 and its final, preview and
+ incubator features, such as:
+
+
+
Record patterns (preview)
+
Virtual threads (preview)
+
Pattern matching for switch (preview 3)
+
Structured concurrency (incubator)
+
+
+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
+this comment. AJC therefore
+inherits the same problems for the specific cases described in the linked issues.
+
+
Improvements
+
+
+ In annotation style aspects, asynchronous proceed() calls in @Around 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 ExecutorService with its own thread pool. This still is not working in annotation style aspects, only in
+ native syntax ones.
+
+ 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):
+
+ 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.
+
+
+
+
Other changes and bug fixes
+
+
+
+ Fix a bug which led to NullPointerExceptions if too many JAR archives were on the classpath. Too many here
+ means the value system property org.aspectj.weaver.openarchives (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
+ #125.
+
+
+ Improvements for if() pointcuts in annotation syntax, see issues
+ #115,
+ #120,
+ #122.
+
+
+ Thanks to Andrey Turbanov for several clean code contributions.
+
+
+
+
AspectJ usage hints
+
+
AspectJ compiler build system requirements
+
+
+ Since 1.9.7, the AspectJ compiler ajc (contained in the aspectjtools 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
+ aspectjrt, but the compiler itself needs JDK 11+. Just like in previous AspectJ versions, both the runtime
+ aspectjrt and the load-time weaver aspectjweaver still only require JRE 8+.
+
+
+
Use LTW on Java 16+
+
+
+ Please note that if you want to use load-time weaving on Java 16+, the weaving agent collides with
+ JEP 396 (Strongly Encapsulate JDK Internals by Default) and related
+ subsequent JEPs. Therefore, you need to set the JVM parameter --add-opens java.base/java.lang=ALL-UNNAMED 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.
+
+
+
Compile with Java preview features
+
+
+ For features marked as preview on a given JDK, you need to compile with ajc --enable-preview and run with
+ java --enable-preview on that JDK.
+
+
+ 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.
+