aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2024-02-19 22:01:05 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2024-02-19 22:01:05 +0700
commit47db35bb48a1ef0919dff62521ca38cd7cf3ccec (patch)
treefce4041a52368870ec8beb8eb5b9a16f36b98ecc /tests/src/test
parent4e4641f8cc06176377a1faf8378e93df9bf248e1 (diff)
downloadaspectj-47db35bb48a1ef0919dff62521ca38cd7cf3ccec.tar.gz
aspectj-47db35bb48a1ef0919dff62521ca38cd7cf3ccec.zip
New abstract class JavaVersionSpecificXMLBasedAjcTestCase
Replaces now obsolete base classes - XMLBasedAjcTestCaseForJava[n]OrLater, - XMLBasedAjcTestCaseForJava[n]Only. The new class is parametrised with minimum and maximum Java version and hence can replace all the other classes. This does not only apply the DRY principle, but also makes adding tests for new Java versions less tedious. By chance, I also noticed missing sanity tests for Java 12, which I added as a little drive-by benefit. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java10
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java10
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java10
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java3
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java7
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java14
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java9
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java9
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java11
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1920/Ajc1920TestsJava.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java13
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java24
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java14
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java12
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java7
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java31
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java93
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java3
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java11
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java16
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java11
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java11
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java24
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java15
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java18
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java16
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Java11Tests.java9
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc198/CompileWithReleaseTests.java7
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc198/Java17PreviewFeaturesTests.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java7
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java15
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java8
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc193/sanity-tests-12.xml69
48 files changed, 446 insertions, 183 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java
index 129cfaad8..14bd4ff12 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java
index 19e50688f..7a6982912 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java
index a73c75077..3c53d53ca 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java
index 38678b750..3dafa7f31 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java
@@ -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)
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java
index 3158a954e..f4995a326 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java b/tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java
index 482d61270..bd6666466 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java
index 79c6ba1ae..f01e07835 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java
@@ -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);
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java
index 5f471490d..df59b1136 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java
index 22e7b6184..1865cd765 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java
index 1207f5cc6..c579ad3d1 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java
@@ -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);
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java
index 9f70c3ff2..4110f17b8 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java
index 4a227ab05..e01d5e88f 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java
@@ -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);
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java b/tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java
index ef6db6278..c8972ff1c 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java
index e0b9034f8..af00c3ab3 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Ajc1920TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Ajc1920TestsJava.java
index cc2770412..d00544b23 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Ajc1920TestsJava.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Ajc1920TestsJava.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java
index ae80c49bc..72fc857ab 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java
index 1a305bce1..78ea35b88 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java
@@ -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);
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java
index 6cd0fd6b7..cafdff62a 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java
index 466135dc2..e221df46e 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java
@@ -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() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java
index 56e8b963a..a8166995b 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java
@@ -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;
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java
index 255583efd..2fd5e8ef8 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java
index 2f4810e4e..0115abec8 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java
index 4f7bd8047..e8d3c5e1c 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java
index 364136be9..403af7b9a 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java
deleted file mode 100644
index 801d99291..000000000
--- a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java
+++ /dev/null
@@ -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");
- }
-
-}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java
new file mode 100644
index 000000000..f3bf166a2
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java
@@ -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");
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java b/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java
index 092160565..093247b62 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java
@@ -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;
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java b/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java
index 34901eb00..f90fd3d3e 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java
index 5659b2931..60fe9e5ab 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java
index 8e19afc14..34d02d8d2 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java
index 24b02101e..0d468f7f7 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java
@@ -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);
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java
index 13094e048..6fa8c06bb 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java
index 8a1f794f4..4150ea8b7 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java
@@ -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() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java
index 7feccc2e2..999071a9f 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java
index f2c04e08c..7a8a61fd6 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java
@@ -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);
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java
index d244ebea7..570b86511 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java
index 1e42ce6d7..d86264a91 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java
index 4df003921..b8f28f56e 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java
@@ -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() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java
index 8e84af9fd..12c80cd10 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Java11Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Java11Tests.java
index 7e99b7d9f..bbf224e29 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Java11Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Java11Tests.java
@@ -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");
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/CompileWithReleaseTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/CompileWithReleaseTests.java
index b0fb2745b..fb21de1fb 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc198/CompileWithReleaseTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/CompileWithReleaseTests.java
@@ -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
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Java17PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Java17PreviewFeaturesTests.java
index abd9213f4..51f158f5e 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Java17PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Java17PreviewFeaturesTests.java
@@ -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");
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java
index 10363e965..0bfb33c7b 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java
index 2b3ad813a..6f89edf8d 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java
@@ -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");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java
index 724fcdf62..76289ed44 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java
@@ -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;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java
index 078a47671..d7f06b14a 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java
@@ -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");
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java
index e2d308ab5..85608cb07 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java
@@ -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");
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc193/sanity-tests-12.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc193/sanity-tests-12.xml
new file mode 100644
index 000000000..b91cce256
--- /dev/null
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc193/sanity-tests-12.xml
@@ -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>