diff options
Diffstat (limited to 'testing')
22 files changed, 48 insertions, 684 deletions
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(); - } - -} |