aboutsummaryrefslogtreecommitdiffstats
path: root/testing/src
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2023-03-28 16:29:12 +0200
committerAlexander Kriegisch <Alexander@Kriegisch.name>2023-06-24 13:10:46 +0700
commitec5e94cc188bfb54ff96b8312548176c3c02c80a (patch)
treeaf12ceda7b843e4dcef2d6585a5f326252027134 /testing/src
parentfbc79b2de7d6742883d41d7a8c91268bd1da3f55 (diff)
downloadaspectj-ec5e94cc188bfb54ff96b8312548176c3c02c80a.tar.gz
aspectj-ec5e94cc188bfb54ff96b8312548176c3c02c80a.zip
Add basic tests for Java 20, deactivate Java 19 preview tests
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing/src')
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java4
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java40
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java27
3 files changed, 69 insertions, 2 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java
index e0a99283d..36b642c30 100644
--- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java
@@ -20,14 +20,13 @@ public abstract class XMLBasedAjcTestCaseForJava19Only extends XMLBasedAjcTestCa
@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 " +
@@ -35,6 +34,7 @@ public abstract class XMLBasedAjcTestCaseForJava19Only extends XMLBasedAjcTestCa
);
}
super.setUp();
+ */
}
}
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java
new file mode 100644
index 000000000..aeb1152fd
--- /dev/null
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.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 XMLBasedAjcTestCaseForJava20Only extends XMLBasedAjcTestCase {
+
+ @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 " +
+ "(e.g. because they use version-specific preview features)"
+ );
+ }
+ super.setUp();
+ }
+
+}
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java
new file mode 100644
index 000000000..352136529
--- /dev/null
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.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 XMLBasedAjcTestCaseForJava20OrLater extends XMLBasedAjcTestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ if (!LangUtil.is20VMOrGreater())
+ throw new IllegalStateException("These tests should be run on Java 20 or later");
+ super.setUp();
+ }
+
+}