From 47db35bb48a1ef0919dff62521ca38cd7cf3ccec Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Mon, 19 Feb 2024 22:01:05 +0700 Subject: New abstract class JavaVersionSpecificXMLBasedAjcTestCase Replaces now obsolete base classes - XMLBasedAjcTestCaseForJava[n]OrLater, - XMLBasedAjcTestCaseForJava[n]Only. The new class is parametrised with minimum and maximum Java version and hence can replace all the other classes. This does not only apply the DRY principle, but also makes adding tests for new Java versions less tedious. By chance, I also noticed missing sanity tests for Java 12, which I added as a little drive-by benefit. Signed-off-by: Alexander Kriegisch --- .../JavaVersionSpecificXMLBasedAjcTestCase.java | 48 ++++++++++++++++++++++ .../XMLBasedAjcTestCaseForJava10OrLater.java | 30 -------------- .../XMLBasedAjcTestCaseForJava11OrLater.java | 30 -------------- .../XMLBasedAjcTestCaseForJava12OrLater.java | 30 -------------- .../XMLBasedAjcTestCaseForJava13OrLater.java | 30 -------------- .../testing/XMLBasedAjcTestCaseForJava14Only.java | 38 ----------------- .../XMLBasedAjcTestCaseForJava14OrLater.java | 27 ------------ .../testing/XMLBasedAjcTestCaseForJava15Only.java | 38 ----------------- .../XMLBasedAjcTestCaseForJava15OrLater.java | 27 ------------ .../testing/XMLBasedAjcTestCaseForJava16Only.java | 40 ------------------ .../XMLBasedAjcTestCaseForJava16OrLater.java | 27 ------------ .../testing/XMLBasedAjcTestCaseForJava17Only.java | 40 ------------------ .../XMLBasedAjcTestCaseForJava17OrLater.java | 27 ------------ .../testing/XMLBasedAjcTestCaseForJava18Only.java | 40 ------------------ .../XMLBasedAjcTestCaseForJava18OrLater.java | 27 ------------ .../testing/XMLBasedAjcTestCaseForJava19Only.java | 40 ------------------ .../XMLBasedAjcTestCaseForJava19OrLater.java | 27 ------------ .../testing/XMLBasedAjcTestCaseForJava20Only.java | 40 ------------------ .../XMLBasedAjcTestCaseForJava20OrLater.java | 27 ------------ .../testing/XMLBasedAjcTestCaseForJava21Only.java | 42 ------------------- .../XMLBasedAjcTestCaseForJava21OrLater.java | 27 ------------ .../XMLBasedAjcTestCaseForJava9OrLater.java | 30 -------------- 22 files changed, 48 insertions(+), 684 deletions(-) create mode 100644 testing/src/test/java/org/aspectj/testing/JavaVersionSpecificXMLBasedAjcTestCase.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java delete mode 100644 testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java (limited to 'testing') diff --git a/testing/src/test/java/org/aspectj/testing/JavaVersionSpecificXMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/JavaVersionSpecificXMLBasedAjcTestCase.java new file mode 100644 index 000000000..a4f5ce7ff --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/JavaVersionSpecificXMLBasedAjcTestCase.java @@ -0,0 +1,48 @@ +/* ******************************************************************* + * Copyright (c) 2024 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 static org.aspectj.util.LangUtil.isVMGreaterOrEqual; +import static org.aspectj.util.LangUtil.isVMLessOrEqual; + +/** + * A test case which only runs on specific Java versions + * + * @author Alexander Kriegisch + */ +public abstract class JavaVersionSpecificXMLBasedAjcTestCase extends XMLBasedAjcTestCase { + private final int minimumJavaVersion; + private final int maximumJavaVersion; + + protected JavaVersionSpecificXMLBasedAjcTestCase(int minimumJavaVersion) { + this(minimumJavaVersion, Integer.MAX_VALUE); + } + + protected JavaVersionSpecificXMLBasedAjcTestCase(int minimumJavaVersion, int maximumJavaVersion) { + this.minimumJavaVersion = minimumJavaVersion; + this.maximumJavaVersion = maximumJavaVersion; + } + + @Override + public void setUp() throws Exception { + boolean withinBounds = isVMGreaterOrEqual(minimumJavaVersion) && isVMLessOrEqual(maximumJavaVersion); + if (!withinBounds) { + String errorMessage = "These tests must run on Java version "; + if (maximumJavaVersion == Integer.MAX_VALUE) + errorMessage += minimumJavaVersion + " or greater"; + else if (maximumJavaVersion == minimumJavaVersion) + errorMessage += minimumJavaVersion + " only"; + else + errorMessage += "range " + minimumJavaVersion + " to " + maximumJavaVersion; + throw new IllegalStateException(errorMessage); + } + super.setUp(); + } + +} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java deleted file mode 100644 index c7d67e4ab..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java +++ /dev/null @@ -1,30 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2018 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 - * - * Contributors: - * Andy Clement - * ******************************************************************/ -package org.aspectj.testing; - -import org.aspectj.util.LangUtil; - -/** - * Ensure sure tests are running on the right level of JDK. - * - * @author Andy Clement - */ -public abstract class XMLBasedAjcTestCaseForJava10OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(10)) - throw new IllegalStateException("These tests should be run on Java 10 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java deleted file mode 100644 index 08f0e0d78..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java +++ /dev/null @@ -1,30 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2018 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 - * - * Contributors: - * Andy Clement - * ******************************************************************/ -package org.aspectj.testing; - -import org.aspectj.util.LangUtil; - -/** - * Makes sure tests are running on the right level of JDK. - * - * @author Andy Clement - */ -public abstract class XMLBasedAjcTestCaseForJava11OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(11)) - throw new IllegalStateException("These tests should be run on Java 11 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java deleted file mode 100644 index fdd94de51..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java +++ /dev/null @@ -1,30 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2018 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 - * - * Contributors: - * Andy Clement - * ******************************************************************/ -package org.aspectj.testing; - -import org.aspectj.util.LangUtil; - -/** - * Ensure sure tests are running on the right level of JDK. - * - * @author Andy Clement - */ -public abstract class XMLBasedAjcTestCaseForJava12OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(12)) - throw new IllegalStateException("These tests should be run on Java 12 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java deleted file mode 100644 index 635785c20..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java +++ /dev/null @@ -1,30 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2019 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 - * - * Contributors: - * Andy Clement - * ******************************************************************/ -package org.aspectj.testing; - -import org.aspectj.util.LangUtil; - -/** - * Makes sure tests are running on the right level of JDK. - * - * @author Andy Clement - */ -public abstract class XMLBasedAjcTestCaseForJava13OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(13)) - throw new IllegalStateException("These tests should be run on Java 13 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java deleted file mode 100644 index e4c864049..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java +++ /dev/null @@ -1,38 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2021 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; - -/** - * Makes sure tests are running on the right level of JDK. - * - * @author Alexander Kriegisch - */ -public abstract class XMLBasedAjcTestCaseForJava14Only extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - // Activate this block after upgrading to JDT Core Java 15 - throw new IllegalStateException( - "These tests need a Java 14 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 15 - /* - if (!LangUtil.isVMGreaterOrEqual(14) || LangUtil.isVMGreaterOrEqual(15)) { - throw new IllegalStateException( - "These tests should be run on Java 14 only " + - "(e.g. because they use version-specific preview features)" - ); - } - super.setUp(); - */ - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java deleted file mode 100644 index 7f6b7c7d3..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2020 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 Andy Clement - */ -public abstract class XMLBasedAjcTestCaseForJava14OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(14)) - throw new IllegalStateException("These tests should be run on Java 14 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java deleted file mode 100644 index dd6ef21e5..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java +++ /dev/null @@ -1,38 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2021 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; - -/** - * Makes sure tests are running on the right level of JDK. - * - * @author Alexander Kriegisch - */ -public abstract class XMLBasedAjcTestCaseForJava15Only extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - // Activate this block after upgrading to JDT Core Java 16 - throw new IllegalStateException( - "These tests need a Java 15 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 16 - /* - if (!LangUtil.isVMGreaterOrEqual(15) || LangUtil.isVMGreaterOrEqual(16)) { - throw new IllegalStateException( - "These tests should be run on Java 15 only " + - "(e.g. because they use version-specific preview features)" - ); - } - super.setUp(); - */ - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java deleted file mode 100644 index ad5f3e108..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2021 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 XMLBasedAjcTestCaseForJava15OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(15)) - throw new IllegalStateException("These tests should be run on Java 15 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java deleted file mode 100644 index 794d5276d..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java +++ /dev/null @@ -1,40 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2021 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 XMLBasedAjcTestCaseForJava16Only extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - // Activate this block after upgrading to JDT Core Java 17 - throw new IllegalStateException( - "These tests need a Java 16 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 17 - /* - if (!LangUtil.isVMGreaterOrEqual(16) || LangUtil.isVMGreaterOrEqual(17)) { - throw new IllegalStateException( - "These tests should be run on Java 16 only " + - "(e.g. because they use version-specific preview features)" - ); - } - super.setUp(); - */ - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java deleted file mode 100644 index 3a763af47..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2021 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 XMLBasedAjcTestCaseForJava16OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(16)) - throw new IllegalStateException("These tests should be run on Java 16 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java deleted file mode 100644 index eeb681b6d..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java +++ /dev/null @@ -1,40 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2021 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 XMLBasedAjcTestCaseForJava17Only extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - // Activate this block after upgrading to JDT Core Java 18 - throw new IllegalStateException( - "These tests need a Java 17 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 18 - /* - if (!LangUtil.isVMGreaterOrEqual(17) || LangUtil.isVMGreaterOrEqual(18)) { - throw new IllegalStateException( - "These tests should be run on Java 17 only " + - "(e.g. because they use version-specific preview features)" - ); - super.setUp(); - } - */ - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java deleted file mode 100644 index bb32898b1..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2021 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 XMLBasedAjcTestCaseForJava17OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(17)) - throw new IllegalStateException("These tests should be run on Java 17 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java deleted file mode 100644 index 21c1dce4f..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java +++ /dev/null @@ -1,40 +0,0 @@ -/* ******************************************************************* - * 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 XMLBasedAjcTestCaseForJava18Only extends XMLBasedAjcTestCase { - - @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.isVMGreaterOrEqual(18) || LangUtil.isVMGreaterOrEqual(19)) { - throw new IllegalStateException( - "These tests should be run on Java 18 only " + - "(e.g. because they use version-specific preview features)" - ); - } - super.setUp(); - */ - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java deleted file mode 100644 index 65fcc325e..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * 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 XMLBasedAjcTestCaseForJava18OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(18)) - throw new IllegalStateException("These tests should be run on Java 18 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java deleted file mode 100644 index e931bc3f9..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java +++ /dev/null @@ -1,40 +0,0 @@ -/* ******************************************************************* - * 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.isVMGreaterOrEqual(19) || LangUtil.isVMGreaterOrEqual(20)) { - 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 deleted file mode 100644 index e33862f32..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * 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.isVMGreaterOrEqual(19)) - throw new IllegalStateException("These tests should be run on Java 19 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java deleted file mode 100644 index 43b50a6bc..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java +++ /dev/null @@ -1,40 +0,0 @@ -/* ******************************************************************* - * 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.isVMGreaterOrEqual(20) || LangUtil.isVMGreaterOrEqual(21)) { - 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 deleted file mode 100644 index 1289d9672..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * 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.isVMGreaterOrEqual(20)) - throw new IllegalStateException("These tests should be run on Java 20 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java deleted file mode 100644 index 3014e1a96..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java +++ /dev/null @@ -1,42 +0,0 @@ -/* ******************************************************************* - * 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 { - // AspectJ_JDK_Update - // 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." - ); - */ - // AspectJ_JDK_Update - // Activate this block before upgrading to JDT Core Java 22 - if (!LangUtil.isVMGreaterOrEqual(21) || LangUtil.isVMGreaterOrEqual(22)) { - 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 deleted file mode 100644 index 11fc3ba7f..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java +++ /dev/null @@ -1,27 +0,0 @@ -/* ******************************************************************* - * 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.isVMGreaterOrEqual(21)) - throw new IllegalStateException("These tests should be run on Java 21 or later"); - super.setUp(); - } - -} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java deleted file mode 100644 index d5decf8b9..000000000 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java +++ /dev/null @@ -1,30 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2018 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 - * - * Contributors: - * Andy Clement - * ******************************************************************/ -package org.aspectj.testing; - -import org.aspectj.util.LangUtil; - -/** - * Makes sure tests are running on the right level of JDK. - * - * @author Andy Clement - */ -public abstract class XMLBasedAjcTestCaseForJava9OrLater extends XMLBasedAjcTestCase { - - @Override - public void setUp() throws Exception { - if (!LangUtil.isVMGreaterOrEqual(9)) - throw new IllegalStateException("These tests should be run on Java 9 or later"); - super.setUp(); - } - -} -- cgit v1.2.3