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 <Alexander@Kriegisch.name>tags/V1_9_21_2
@@ -251,9 +251,9 @@ public class AjcTask extends MatchingTask { | |||
public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR"; | |||
// AspectJ_JDK_Update: Check minimum supported ECJ version, currently 1.3 | |||
static final int JAVA_VERSION_MIN = 3; | |||
public static final int JAVA_VERSION_MIN = 3; | |||
// AspectJ_JDK_Update: Check maximum supported ECJ version | |||
static final int JAVA_VERSION_MAX = 21; | |||
public static final int JAVA_VERSION_MAX = 21; | |||
static final String[] SOURCE_INPUTS; | |||
static final String[] TARGET_INPUTS; |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
*/ | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
*/ | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
*/ | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
*/ | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
*/ | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
*/ | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
*/ | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -10,15 +10,17 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc190; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava9OrLater; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Ajc190Tests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
public class Ajc190Tests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Ajc190Tests() { | |||
super(9); | |||
} | |||
public void testParamAnnosNegative() { | |||
runTest("param annos negative"); |
@@ -17,13 +17,11 @@ public class AllTestsAspectJ190 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.0 tests"); | |||
// $JUnit-BEGIN$ | |||
suite.addTest(Ajc190Tests.suite()); | |||
suite.addTest(SanityTests19.suite()); | |||
suite.addTest(EfficientTJPTests.suite()); | |||
suite.addTest(ModuleTests.suite()); | |||
suite.addTest(Annotations.suite()); | |||
// $JUnit-END$ | |||
return suite; | |||
} | |||
} |
@@ -7,16 +7,15 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc190; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.classfile.Attribute; | |||
import org.aspectj.apache.bcel.classfile.Code; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.apache.bcel.classfile.Method; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava9OrLater; | |||
import org.aspectj.util.LangUtil; | |||
import junit.framework.Test; | |||
/** | |||
* Building and weaving with modules in the picture. | |||
* | |||
@@ -25,7 +24,10 @@ import junit.framework.Test; | |||
* @author Andy Clement | |||
* | |||
*/ | |||
public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
public class ModuleTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public ModuleTests() { | |||
super(9); | |||
} | |||
public void testBuildAModule() { | |||
runTest("build a module"); |
@@ -20,7 +20,7 @@ import junit.framework.Test; | |||
* These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -1.9 option | |||
* to check code generation and modification with that version specified. | |||
*/ | |||
public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
public class SanityTests19 extends XMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(9).MAJOR; | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) |
@@ -10,15 +10,17 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc191; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava10OrLater; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Ajc191Tests extends XMLBasedAjcTestCaseForJava10OrLater { | |||
public class Ajc191Tests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Ajc191Tests() { | |||
super(10); | |||
} | |||
public void testVar1() { | |||
runTest("var 1"); |
@@ -17,10 +17,8 @@ public class AllTestsAspectJ191 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.1 tests"); | |||
// $JUnit-BEGIN$ | |||
suite.addTest(Ajc191Tests.suite()); | |||
suite.addTest(SanityTestsJava10.suite()); | |||
// $JUnit-END$ | |||
return suite; | |||
} | |||
} |
@@ -19,7 +19,7 @@ import junit.framework.Test; | |||
* | |||
* @author Andy Clement | |||
*/ | |||
public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
public class SanityTestsJava10 extends XMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(10).MAJOR; | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
@@ -74,7 +74,6 @@ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); | |||
} | |||
// /////////////////////////////////////// | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(SanityTestsJava10.class); | |||
} |
@@ -8,13 +8,16 @@ | |||
package org.aspectj.systemtest.ajc1919; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Ajc1919TestsJava extends XMLBasedAjcTestCaseForJava19OrLater { | |||
public class Ajc1919TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Ajc1919TestsJava() { | |||
super(19); | |||
} | |||
public void testDummyJava19() { | |||
//runTest("dummy Java 19"); |
@@ -9,6 +9,7 @@ package org.aspectj.systemtest.ajc1919; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
import org.aspectj.tools.ant.taskdefs.AjcTask; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
@@ -16,19 +17,22 @@ import org.aspectj.util.LangUtil; | |||
*/ | |||
public class AllTestsAspectJ1919 { | |||
private static final int JAVA_VERSION = 19; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.19 tests"); | |||
suite.addTest(Bugs1919Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(19)) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava19.suite()); | |||
suite.addTest(Ajc1919TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.isVMGreaterOrEqual(19) && !LangUtil.isVMGreaterOrEqual(20)) { | |||
suite.addTest(Java19PreviewFeaturesTests.suite()); | |||
if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) { | |||
suite.addTest(Java19PreviewFeaturesTests.suite()); | |||
} | |||
} | |||
*/ | |||
return suite; | |||
} | |||
} |
@@ -9,15 +9,19 @@ package org.aspectj.systemtest.ajc1919; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava19Only; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Java19PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava19Only { | |||
public class Java19PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(19); | |||
public Java19PreviewFeaturesTests() { | |||
super(19, 19); | |||
} | |||
public void testSwitchPatternMatchingPreview3Java() { | |||
runTest("switch pattern matching preview 3 java"); | |||
checkVersion("SwitchPatternPreview3OK", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); |
@@ -9,8 +9,8 @@ package org.aspectj.systemtest.ajc1919; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -19,10 +19,13 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava19 extends XMLBasedAjcTestCaseForJava19OrLater { | |||
public class SanityTestsJava19 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(19).MAJOR; | |||
public SanityTestsJava19() { | |||
super(19); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -10,23 +10,22 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc192; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.apache.bcel.classfile.NestHost; | |||
import org.aspectj.apache.bcel.classfile.NestMembers; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import junit.framework.Test; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Ajc192Tests extends XMLBasedAjcTestCase { | |||
public void testITDLambdas() throws Exception { | |||
public void testITDLambdas() { | |||
runTest("itd lambdas"); | |||
} | |||
public void test11Flags() throws Exception { | |||
public void test11Flags() { | |||
runTest("11flags"); | |||
} | |||
@@ -82,8 +81,6 @@ public class Ajc192Tests extends XMLBasedAjcTestCase { | |||
runTest("ptw - privileged same package"); | |||
} | |||
// --- | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(Ajc192Tests.class); | |||
} |
@@ -17,10 +17,8 @@ public class AllTestsAspectJ192 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.2 tests"); | |||
// $JUnit-BEGIN$ | |||
suite.addTest(Ajc192Tests.suite()); | |||
suite.addTest(SanityTestsJava11.suite()); | |||
// $JUnit-END$ | |||
return suite; | |||
} | |||
} |
@@ -7,11 +7,10 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc192; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava11OrLater; | |||
import junit.framework.Test; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -20,9 +19,13 @@ import junit.framework.Test; | |||
* | |||
* @author Andy Clement | |||
*/ | |||
public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { | |||
public class SanityTestsJava11 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(11).MAJOR; | |||
public SanityTestsJava11() { | |||
super(11); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -8,13 +8,17 @@ | |||
package org.aspectj.systemtest.ajc1920; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava20OrLater; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Ajc1920TestsJava extends XMLBasedAjcTestCaseForJava20OrLater { | |||
public class Ajc1920TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Ajc1920TestsJava() { | |||
super(20); | |||
} | |||
public void testDummyJava20() { | |||
//runTest("dummy Java 20"); |
@@ -9,26 +9,29 @@ package org.aspectj.systemtest.ajc1920; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
import org.aspectj.tools.ant.taskdefs.AjcTask; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class AllTestsAspectJ1920 { | |||
private static final int JAVA_VERSION = 20; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.20 tests"); | |||
suite.addTest(Bugs1920Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(20)) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava20.suite()); | |||
suite.addTest(Ajc1920TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.isVMGreaterOrEqual(20) && !LangUtil.isVMGreaterOrEqual(21)) { | |||
suite.addTest(Java20PreviewFeaturesTests.suite()); | |||
if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) { | |||
suite.addTest(Java20PreviewFeaturesTests.suite()); | |||
} | |||
} | |||
*/ | |||
return suite; | |||
} | |||
} |
@@ -9,15 +9,19 @@ package org.aspectj.systemtest.ajc1920; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava20Only; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Java20PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava20Only { | |||
public class Java20PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(20); | |||
public Java20PreviewFeaturesTests() { | |||
super(20, 20); | |||
} | |||
public void testSwitchPatternMatchingPreview4Java() { | |||
runTest("switch pattern matching preview 4 java"); | |||
checkVersion("SwitchPatternPreview4OK", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); |
@@ -9,8 +9,8 @@ package org.aspectj.systemtest.ajc1920; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava20OrLater; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -19,10 +19,14 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava20OrLater; | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava20 extends XMLBasedAjcTestCaseForJava20OrLater { | |||
public class SanityTestsJava20 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(20).MAJOR; | |||
public SanityTestsJava20() { | |||
super(20); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -9,17 +9,23 @@ package org.aspectj.systemtest.ajc1921; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Ajc1921TestsJava extends XMLBasedAjcTestCaseForJava21OrLater { | |||
public class Ajc1921TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(21); | |||
public Ajc1921TestsJava() { | |||
super(21); | |||
} | |||
public void testSwitchPatternMatchingPreview4Java() { | |||
runTest("switch pattern matching preview 4 java"); | |||
checkVersion("SwitchPatternPreview4OK", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); | |||
checkVersion("SwitchPatternPreview4OK", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testSwitchPatternMatchingPreview4Error() { | |||
@@ -28,10 +34,10 @@ public class Ajc1921TestsJava extends XMLBasedAjcTestCaseForJava21OrLater { | |||
public void testSwitchPatternMatchingPreview3Aspect() { | |||
runTest("switch pattern matching preview 3 aspect"); | |||
checkVersion("SwitchPatternPreview3Aspect", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); | |||
checkVersion("Application", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); | |||
checkVersion("Shape", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); | |||
checkVersion("S", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); | |||
checkVersion("SwitchPatternPreview3Aspect", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
checkVersion("Application", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
checkVersion("Shape", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
checkVersion("S", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { | |||
@@ -54,8 +60,8 @@ public class Ajc1921TestsJava extends XMLBasedAjcTestCaseForJava21OrLater { | |||
public void testRecordPatternsPreview1Error() { | |||
// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 (fixed for preview 2 in Eclipse 2023-03, 4.27) | |||
runTest("record patterns error"); | |||
checkVersion("RecordPatternsPreview1Error", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); | |||
checkVersion("Box", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); | |||
checkVersion("RecordPatternsPreview1Error", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
checkVersion("Box", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testRecordPatternsPreview1ExhaustivenessOK1() { |
@@ -9,6 +9,7 @@ package org.aspectj.systemtest.ajc1921; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
import org.aspectj.tools.ant.taskdefs.AjcTask; | |||
import org.aspectj.util.LangUtil; | |||
// AspectJ_JDK_Update | |||
@@ -28,18 +29,21 @@ import org.aspectj.util.LangUtil; | |||
*/ | |||
public class AllTestsAspectJ1921 { | |||
private static final int JAVA_VERSION = 21; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.21 tests"); | |||
suite.addTest(Bugs1921Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(21)) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava21.suite()); | |||
suite.addTest(Ajc1921TestsJava.suite()); | |||
} | |||
// AspectJ_JDK_Update | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
// TODO: Comment out the following block when upgrading JDT Core to Java 22 | |||
if (LangUtil.isVMGreaterOrEqual(21) && !LangUtil.isVMGreaterOrEqual(22)) { | |||
suite.addTest(Java21PreviewFeaturesTests.suite()); | |||
if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) { | |||
suite.addTest(Java21PreviewFeaturesTests.suite()); | |||
} | |||
} | |||
return suite; | |||
} |
@@ -9,13 +9,17 @@ package org.aspectj.systemtest.ajc1921; | |||
import junit.framework.Test; | |||
import org.aspectj.systemtest.ajc10x.Ajc10xTests; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava21Only; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Java21PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava21Only { | |||
public class Java21PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Java21PreviewFeaturesTests() { | |||
super(21, 21); | |||
} | |||
public void testStringPatterns() { | |||
runTest("string patterns"); |
@@ -9,8 +9,8 @@ package org.aspectj.systemtest.ajc1921; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -19,10 +19,14 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater; | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava21 extends XMLBasedAjcTestCaseForJava21OrLater { | |||
public class SanityTestsJava21 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(21).MAJOR; | |||
public SanityTestsJava21() { | |||
super(21); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -7,19 +7,21 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc193; | |||
import java.io.File; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava10OrLater; | |||
import org.aspectj.weaver.WeaverStateInfo; | |||
import junit.framework.Test; | |||
import java.io.File; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Ajc193Tests extends XMLBasedAjcTestCaseForJava10OrLater { | |||
public class Ajc193Tests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Ajc193Tests() { | |||
super(10); | |||
} | |||
public void testNestedAroundProceed() { | |||
runTest("nested around proceed"); |
@@ -12,13 +12,18 @@ package org.aspectj.systemtest.ajc193; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
import org.aspectj.util.LangUtil; | |||
public class AllTestsAspectJ193 { | |||
private static final int JAVA_VERSION = 12; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.3 tests"); | |||
suite.addTest(Ajc193Tests.suite()); | |||
// suite.addTest(Java13Tests.suite()); | |||
// suite.addTest(Java12Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava12.suite()); | |||
} | |||
return suite; | |||
} | |||
} |
@@ -1,31 +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 | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc193; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava13OrLater; | |||
import junit.framework.Test; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Java13Tests extends XMLBasedAjcTestCaseForJava13OrLater { | |||
// --- | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(Java13Tests.class); | |||
} | |||
@Override | |||
protected java.net.URL getSpecFile() { | |||
return getClassResource("ajc193.xml"); | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
/******************************************************************************* | |||
* 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.systemtest.ajc193; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
* These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -12 option | |||
* to check code generation and modification with that version specified. | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava12 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(12).MAJOR; | |||
public SanityTestsJava12() { | |||
super(12); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); | |||
} | |||
public void testSimpleJava_B() { | |||
runTest("simple - b"); | |||
} | |||
public void testSimpleCode_C() { | |||
runTest("simple - c"); | |||
} | |||
public void testSimpleCode_D() { | |||
runTest("simple - d"); | |||
} | |||
public void testSimpleCode_E() { | |||
runTest("simple - e"); | |||
} | |||
public void testSimpleCode_F() { | |||
runTest("simple - f"); | |||
} | |||
public void testSimpleCode_G() { | |||
runTest("simple - g"); | |||
} | |||
public void testSimpleCode_H() { | |||
runTest("simple - h", true); | |||
} | |||
public void testSimpleCode_I() { | |||
runTest("simple - i"); | |||
} | |||
public void testVersionCorrect1() throws ClassNotFoundException { | |||
runTest("simple - j"); | |||
checkVersion("A", bytecode_version_for_JDK_level, 0); | |||
} | |||
public void testVersionCorrect2() throws ClassNotFoundException { | |||
runTest("simple - k"); | |||
checkVersion("A", bytecode_version_for_JDK_level, 0); | |||
} | |||
public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified | |||
runTest("simple - m"); | |||
checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); | |||
} | |||
// /////////////////////////////////////// | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(SanityTestsJava12.class); | |||
} | |||
@Override | |||
protected java.net.URL getSpecFile() { | |||
return getClassResource("sanity-tests-12.xml"); | |||
} | |||
} |
@@ -16,11 +16,12 @@ import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
public class AllTestsAspectJ195 { | |||
private static final int JAVA_VERSION = 13; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.5 tests"); | |||
suite.addTest(Ajc195Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(13)) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava13.suite()); | |||
} | |||
return suite; |
@@ -8,8 +8,8 @@ | |||
package org.aspectj.systemtest.ajc195; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava13OrLater; | |||
import junit.framework.Test; | |||
@@ -20,10 +20,14 @@ import junit.framework.Test; | |||
* | |||
* @author Andy Clement | |||
*/ | |||
public class SanityTestsJava13 extends XMLBasedAjcTestCaseForJava13OrLater { | |||
public class SanityTestsJava13 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(13).MAJOR; | |||
public SanityTestsJava13() { | |||
super(13); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -7,16 +7,19 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc196; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava14OrLater; | |||
import junit.framework.Test; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Ajc196Tests extends XMLBasedAjcTestCaseForJava14OrLater { | |||
public class Ajc196Tests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Ajc196Tests() { | |||
super(14); | |||
} | |||
public void testNPE_558995() { | |||
runTest("early resolution of supporting interfaces"); |
@@ -7,6 +7,7 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc196; | |||
import org.aspectj.tools.ant.taskdefs.AjcTask; | |||
import org.aspectj.util.LangUtil; | |||
import junit.framework.Test; | |||
@@ -16,19 +17,22 @@ import junit.framework.TestSuite; | |||
* @author Andy Clement | |||
*/ | |||
public class AllTestsAspectJ196 { | |||
private static final int JAVA_VERSION = 14; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.6 tests"); | |||
if (LangUtil.isVMGreaterOrEqual(14)) { | |||
suite.addTest(Ajc196Tests.suite()); | |||
//suite.addTest(Bugs196Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava14.suite()); | |||
suite.addTest(Ajc196Tests.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.isVMGreaterOrEqual(14) && !LangUtil.isVMGreaterOrEqual(15)) { | |||
suite.addTest(Java14PreviewFeaturesTests.suite()); | |||
if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) { | |||
suite.addTest(Java14PreviewFeaturesTests.suite()); | |||
} | |||
} | |||
*/ | |||
return suite; | |||
} | |||
} |
@@ -7,18 +7,21 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc196; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava14Only; | |||
import junit.framework.Test; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Java14PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava14Only { | |||
public class Java14PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(14); | |||
public Java14PreviewFeaturesTests() { | |||
super(14, 14); | |||
} | |||
public void testRecords() { | |||
runTest("simple record"); | |||
checkVersion("Person", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); |
@@ -7,11 +7,10 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc196; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava14OrLater; | |||
import junit.framework.Test; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -20,10 +19,14 @@ import junit.framework.Test; | |||
* | |||
* @author Andy Clement | |||
*/ | |||
public class SanityTestsJava14 extends XMLBasedAjcTestCaseForJava14OrLater { | |||
public class SanityTestsJava14 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(14).MAJOR; | |||
public SanityTestsJava14() { | |||
super(14); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -9,47 +9,53 @@ package org.aspectj.systemtest.ajc197; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava16OrLater; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Ajc197TestsJava extends XMLBasedAjcTestCaseForJava16OrLater { | |||
public class Ajc197TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(16); | |||
public Ajc197TestsJava() { | |||
super(16); | |||
} | |||
public void testHiddenClass() { | |||
runTest("hidden class"); | |||
checkVersion("HiddenClassDemo", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); | |||
checkVersion("HiddenClassDemo", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testTextBlock1() { | |||
runTest("textblock 1"); | |||
checkVersion("Code", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); | |||
checkVersion("Code", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testTextBlock2() { | |||
runTest("textblock 2"); | |||
checkVersion("Code2", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); | |||
checkVersion("Code2", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testRecords() { | |||
runTest("simple record"); | |||
checkVersion("Person", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); | |||
checkVersion("Person", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testRecords2() { | |||
runTest("using a record"); | |||
checkVersion("UsingPersonRecord", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); | |||
checkVersion("UsingPersonRecord", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testAdvisingRecords() { | |||
runTest("advising records"); | |||
checkVersion("TraceRecordComponents", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); | |||
checkVersion("TraceRecordComponents", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testInstanceofPatterns() { | |||
runTest("instanceof patterns"); | |||
checkVersion("Jep305", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); | |||
checkVersion("Jep305", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public static Test suite() { |
@@ -9,6 +9,7 @@ package org.aspectj.systemtest.ajc197; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
import org.aspectj.tools.ant.taskdefs.AjcTask; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
@@ -16,21 +17,25 @@ import org.aspectj.util.LangUtil; | |||
*/ | |||
public class AllTestsAspectJ197 { | |||
private static final int JAVA_VERSION = 16; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.7 tests"); | |||
//suite.addTest(Bugs197Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(15)) { | |||
suite.addTest(SanityTestsJava15.suite()); | |||
} | |||
if (LangUtil.isVMGreaterOrEqual(16)) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava16.suite()); | |||
suite.addTest(Ajc197TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.isVMGreaterOrEqual(16) && !LangUtil.isVMGreaterOrEqual(17)) { | |||
suite.addTest(Java16PreviewFeaturesTests.suite()); | |||
if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) { | |||
suite.addTest(Java16PreviewFeaturesTests.suite()); | |||
} | |||
} | |||
*/ | |||
return suite; | |||
} | |||
} |
@@ -9,15 +9,19 @@ package org.aspectj.systemtest.ajc197; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava16Only; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Java16PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava16Only { | |||
public class Java16PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(16); | |||
public Java16PreviewFeaturesTests() { | |||
super(16, 16); | |||
} | |||
public void testSealedClassWithLegalSubclasses() { | |||
runTest("sealed class with legal subclasses"); | |||
checkVersion("Employee", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); |
@@ -9,8 +9,8 @@ package org.aspectj.systemtest.ajc197; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava15OrLater; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -19,10 +19,14 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava15OrLater; | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava15 extends XMLBasedAjcTestCaseForJava15OrLater { | |||
public class SanityTestsJava15 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(15).MAJOR; | |||
public SanityTestsJava15() { | |||
super(15); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -9,8 +9,8 @@ package org.aspectj.systemtest.ajc197; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava16OrLater; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -19,10 +19,14 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava16OrLater; | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava16 extends XMLBasedAjcTestCaseForJava16OrLater { | |||
public class SanityTestsJava16 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(16).MAJOR; | |||
public SanityTestsJava16() { | |||
super(16); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -9,28 +9,34 @@ package org.aspectj.systemtest.ajc198; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava17OrLater; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Ajc198TestsJava extends XMLBasedAjcTestCaseForJava17OrLater { | |||
public class Ajc198TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(17); | |||
public Ajc198TestsJava() { | |||
super(17); | |||
} | |||
public void testSealedClassWithLegalSubclasses() { | |||
runTest("sealed class with legal subclasses"); | |||
checkVersion("Employee", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); | |||
checkVersion("Manager", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); | |||
checkVersion("Employee", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
checkVersion("Manager", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testSealedClassWithIllegalSubclass() { | |||
runTest("sealed class with illegal subclass"); | |||
checkVersion("Person", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); | |||
checkVersion("Person", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public void testWeaveSealedClass() { | |||
runTest("weave sealed class"); | |||
checkVersion("PersonAspect", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); | |||
checkVersion("PersonAspect", classFileVersion.MAJOR, classFileVersion.MINOR); | |||
} | |||
public static Test suite() { |
@@ -9,6 +9,7 @@ package org.aspectj.systemtest.ajc198; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
import org.aspectj.tools.ant.taskdefs.AjcTask; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
@@ -16,25 +17,28 @@ import org.aspectj.util.LangUtil; | |||
*/ | |||
public class AllTestsAspectJ198 { | |||
private static final int JAVA_VERSION = 17; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.8 tests"); | |||
suite.addTest(Bugs198Tests.suite()); | |||
suite.addTest(Bugs198Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
suite.addTest(CompileWithReleaseTests.suite()); | |||
} | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
suite.addTest(Bugs198Java11Tests.suite()); | |||
} | |||
if (LangUtil.isVMGreaterOrEqual(17)) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava17.suite()); | |||
suite.addTest(Ajc198TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.isVMGreaterOrEqual(17) && !LangUtil.isVMGreaterOrEqual(18)) { | |||
suite.addTest(Java17PreviewFeaturesTests.suite()); | |||
if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) { | |||
suite.addTest(Java17PreviewFeaturesTests.suite()); | |||
} | |||
} | |||
*/ | |||
return suite; | |||
} | |||
} |
@@ -8,15 +8,18 @@ | |||
package org.aspectj.systemtest.ajc198; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava11OrLater; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Bugs198Java11Tests extends XMLBasedAjcTestCaseForJava11OrLater { | |||
public class Bugs198Java11Tests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Bugs198Java11Tests() { | |||
super(11); | |||
} | |||
public void testGitHub_68() { | |||
public void testGitHub_68() { | |||
runTest("correctly weave code using constant-dynamic"); | |||
} | |||
@@ -11,15 +11,18 @@ import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.apache.bcel.classfile.Method; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava9OrLater; | |||
import java.util.Objects; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class CompileWithReleaseTests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
public class CompileWithReleaseTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public CompileWithReleaseTests() { | |||
super(9); | |||
} | |||
/** | |||
* In order to avoid a complicated test involving two different JDKs (9+ for compilation, 8 for runtime), we inspect |
@@ -9,15 +9,19 @@ package org.aspectj.systemtest.ajc198; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava17Only; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Java17PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava17Only { | |||
public class Java17PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(17); | |||
public Java17PreviewFeaturesTests() { | |||
super(17, 17); | |||
} | |||
public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { | |||
runTest("switch pattern matching error"); | |||
} |
@@ -9,8 +9,8 @@ package org.aspectj.systemtest.ajc198; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava17OrLater; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -19,10 +19,14 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava17OrLater; | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava17 extends XMLBasedAjcTestCaseForJava17OrLater { | |||
public class SanityTestsJava17 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(17).MAJOR; | |||
public SanityTestsJava17() { | |||
super(17); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -8,13 +8,16 @@ | |||
package org.aspectj.systemtest.ajc199; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Ajc199TestsJava extends XMLBasedAjcTestCaseForJava18OrLater { | |||
public class Ajc199TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public Ajc199TestsJava() { | |||
super(18); | |||
} | |||
public void testDummyJava18() { | |||
//runTest("dummy Java 18"); |
@@ -9,26 +9,29 @@ package org.aspectj.systemtest.ajc199; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
import org.aspectj.tools.ant.taskdefs.AjcTask; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class AllTestsAspectJ199 { | |||
private static final int JAVA_VERSION = 18; | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.9 tests"); | |||
suite.addTest(Bugs199Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(18)) { | |||
suite.addTest(Bugs199Tests.suite()); | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { | |||
suite.addTest(SanityTestsJava18.suite()); | |||
suite.addTest(Ajc199TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.isVMGreaterOrEqual(18) && !LangUtil.isVMGreaterOrEqual(19)) { | |||
suite.addTest(Java18PreviewFeaturesTests.suite()); | |||
if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) { | |||
if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) { | |||
suite.addTest(Java18PreviewFeaturesTests.suite()); | |||
} | |||
} | |||
*/ | |||
return suite; | |||
} | |||
} |
@@ -9,15 +9,19 @@ package org.aspectj.systemtest.ajc199; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava18Only; | |||
/** | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class Java18PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava18Only { | |||
public class Java18PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(18); | |||
public Java18PreviewFeaturesTests() { | |||
super(18, 18); | |||
} | |||
public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { | |||
runTest("switch pattern matching error"); | |||
} |
@@ -9,8 +9,8 @@ package org.aspectj.systemtest.ajc199; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
@@ -19,10 +19,14 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; | |||
* | |||
* @author Alexander Kriegisch | |||
*/ | |||
public class SanityTestsJava18 extends XMLBasedAjcTestCaseForJava18OrLater { | |||
public class SanityTestsJava18 extends JavaVersionSpecificXMLBasedAjcTestCase { | |||
public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(18).MAJOR; | |||
public SanityTestsJava18() { | |||
super(18); | |||
} | |||
// Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) | |||
public void testSimpleJava_A() { | |||
runTest("simple - a"); |
@@ -0,0 +1,69 @@ | |||
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> | |||
<suite> | |||
<!-- empty class --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - a"> | |||
<compile files="SimpleA.java" options="-12"/> | |||
</ajc-test> | |||
<!-- class with one method --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - b"> | |||
<compile files="SimpleB.java" options="-12"/> | |||
<run class="SimpleB"/> | |||
</ajc-test> | |||
<!-- empty aspect --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - c"> | |||
<compile files="SimpleC.java" options="-12"/> | |||
</ajc-test> | |||
<!-- simple before --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - d"> | |||
<compile files="SimpleD.java" options="-12"/> | |||
</ajc-test> | |||
<!-- simple itd field --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - e"> | |||
<compile files="SimpleE.java" options="-12"/> | |||
</ajc-test> | |||
<!-- aspect with main calling a static method --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - f"> | |||
<compile files="SimpleF.java" options="-12"/> | |||
</ajc-test> | |||
<!-- pertarget --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - g"> | |||
<compile files="SimpleG.java" options="-12"/> | |||
</ajc-test> | |||
<!-- generic ctor itds --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - h"> | |||
<compile files="SimpleH.java" options="-12"/> | |||
</ajc-test> | |||
<!-- overriding generic itd methods --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - i"> | |||
<compile files="SimpleI.java" options="-12"/> | |||
</ajc-test> | |||
<!-- check class file version is 57.0 --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - j"> | |||
<compile files="SimpleJ.java" options="-12"/> | |||
</ajc-test> | |||
<!-- check class file version is 57.0 --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - k"> | |||
<compile files="SimpleJ.java" options="-source 12"/> | |||
</ajc-test> | |||
<!-- check class file version is 49.0 --> | |||
<ajc-test dir="bugs160/simplejava" title="simple - m"> | |||
<compile files="SimpleJ.java" options="-1.5"/> | |||
</ajc-test> | |||
<ajc-test dir="bugs160/simplejava" title="simple - n"> | |||
<compile files="SimpleN.java" options="-12"/> | |||
</ajc-test> | |||
</suite> |
@@ -115,7 +115,15 @@ public class LangUtil { | |||
} | |||
public static boolean isVMGreaterOrEqual(double javaVersion) { | |||
return javaVersion <= vmVersion; | |||
return vmVersion >= javaVersion; | |||
} | |||
public static boolean isVMLessOrEqual(int javaVersion) { | |||
return isVMLessOrEqual((double) javaVersion); | |||
} | |||
public static boolean isVMLessOrEqual(double javaVersion) { | |||
return vmVersion <= javaVersion; | |||
} | |||
/** |