aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-14 13:58:37 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-14 13:58:37 +0700
commitef21abde05b925df6774f872437812fff1b3f9ee (patch)
tree4c3062a839138400f76e32876ac0346b8f77f573 /testing
parentbf48d9dd07a7ebd5ac61b66df5c478b59fca831a (diff)
downloadaspectj-ef21abde05b925df6774f872437812fff1b3f9ee.tar.gz
aspectj-ef21abde05b925df6774f872437812fff1b3f9ee.zip
Make sure Java 14-only tests using preview are not executed on JVM 15+
Some Ajc196 tests are using preview features (see .../ajc196.xml), i.e. they will fail on Java 15+ because code compiled with '--enable-preview' can only run on the same JVM version, not on a more recent one. Hence, the preview-using tests are now being excluded in order to make the build run on Java 15, even though no Java 15 features are present in the current 1.9.7 snapshot. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java
new file mode 100644
index 000000000..3bdb4d6be
--- /dev/null
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 2021 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * ******************************************************************/
+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 XMLBasedAjcTestCaseForJava14Only extends XMLBasedAjcTestCase {
+
+ @Override
+ public void runTest(String title) {
+ if (!LangUtil.is14VMOrGreater() || LangUtil.is15VMOrGreater()) {
+ throw new IllegalStateException(
+ "These tests should be run on Java 14 only " +
+ "(e.g. because they use version-specific preview features)"
+ );
+ }
+ super.runTest(title);
+ }
+
+}