aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2023-10-05 08:09:24 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2023-10-05 08:09:24 +0700
commit78ee9cebd81f1496d69bd0c933e3ee16fa02a96f (patch)
treef730564caf08786026dc6c9196fb8ba9d9fc3fc9 /testing
parent3533dcd043ca31e6988fae714882328d23543a65 (diff)
downloadaspectj-78ee9cebd81f1496d69bd0c933e3ee16fa02a96f.tar.gz
aspectj-78ee9cebd81f1496d69bd0c933e3ee16fa02a96f.zip
Add test infrastructure for Java 21 (WIP)
The tests and their XML definitions are still copy & paste and need to be cleaned up. Separate Java 21 feature tests do not exist yet. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java4
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java40
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java27
3 files changed, 69 insertions, 2 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java
index aeb1152fd..4e0567d0d 100644
--- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java
@@ -20,14 +20,13 @@ public abstract class XMLBasedAjcTestCaseForJava20Only extends XMLBasedAjcTestCa
@Override
public void setUp() throws Exception {
// Activate this block after upgrading to JDT Core Java 21
- /*
throw new IllegalStateException(
"These tests need a Java 20 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 21
+ /*
if (!LangUtil.is20VMOrGreater() || LangUtil.is21VMOrGreater()) {
throw new IllegalStateException(
"These tests should be run on Java 20 only " +
@@ -35,6 +34,7 @@ public abstract class XMLBasedAjcTestCaseForJava20Only extends XMLBasedAjcTestCa
);
}
super.setUp();
+ */
}
}
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java
new file mode 100644
index 000000000..fb6795b3d
--- /dev/null
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java
@@ -0,0 +1,40 @@
+/* *******************************************************************
+ * Copyright (c) 2023 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 XMLBasedAjcTestCaseForJava21Only extends XMLBasedAjcTestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ // Activate this block after upgrading to JDT Core Java 22
+ /*
+ throw new IllegalStateException(
+ "These tests need a Java 21 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 22
+ if (!LangUtil.is21VMOrGreater() || LangUtil.is22VMOrGreater()) {
+ throw new IllegalStateException(
+ "These tests should be run on Java 21 only " +
+ "(e.g. because they use version-specific preview features)"
+ );
+ }
+ super.setUp();
+ }
+
+}
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java
new file mode 100644
index 000000000..4c1d59d15
--- /dev/null
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java
@@ -0,0 +1,27 @@
+/* *******************************************************************
+ * Copyright (c) 2023 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 XMLBasedAjcTestCaseForJava21OrLater extends XMLBasedAjcTestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ if (!LangUtil.is21VMOrGreater())
+ throw new IllegalStateException("These tests should be run on Java 21 or later");
+ super.setUp();
+ }
+
+}