diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-19 13:19:49 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-19 13:19:49 +0700 |
commit | f3450726d21518bd51deaf46629682d328bb3338 (patch) | |
tree | 7dfb501fe253bd06ed577fe7317c81eeb9507908 /tests/src/test/java/org/aspectj/systemtest/ajc198 | |
parent | 198957fd26d1e5cd347c0c1c3a0c9100295af4cf (diff) | |
download | aspectj-f3450726d21518bd51deaf46629682d328bb3338.tar.gz aspectj-f3450726d21518bd51deaf46629682d328bb3338.zip |
Remove most MINOR_*, MINOR_* BCEL class file versions
in favour of Constants.ClassFileVersion.of(int, int). The few ones
retained are used from production code, the vast majority of removed
ones only from test code.
This gets rid of yet another 'AspectJ_JDK_Update' tag. One less place to
check and update with each newly supported Java version. :-)
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc198')
4 files changed, 13 insertions, 12 deletions
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 3e6ead467..4df003921 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java @@ -19,18 +19,18 @@ public class Ajc198TestsJava extends XMLBasedAjcTestCaseForJava17OrLater { public void testSealedClassWithLegalSubclasses() { runTest("sealed class with legal subclasses"); - checkVersion("Employee", Constants.MAJOR_17, Constants.MINOR_17); - checkVersion("Manager", Constants.MAJOR_17, Constants.MINOR_17); + checkVersion("Employee", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); + checkVersion("Manager", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); } public void testSealedClassWithIllegalSubclass() { runTest("sealed class with illegal subclass"); - checkVersion("Person", Constants.MAJOR_17, Constants.MINOR_17); + checkVersion("Person", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); } public void testWeaveSealedClass() { runTest("weave sealed class"); - checkVersion("PersonAspect", Constants.MAJOR_17, Constants.MINOR_17); + checkVersion("PersonAspect", Constants.ClassFileVersion.of(17).MAJOR, Constants.ClassFileVersion.of(17).MINOR); } public static Test suite() { 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 c24c7e58e..b0fb2745b 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/CompileWithReleaseTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/CompileWithReleaseTests.java @@ -32,7 +32,7 @@ public class CompileWithReleaseTests extends XMLBasedAjcTestCaseForJava9OrLater // Check compiled byte code version String className = "Buffers"; - checkVersion(className, Constants.MAJOR_1_8, Constants.MINOR_1_8); + checkVersion(className, Constants.ClassFileVersion.of(8).MAJOR, Constants.ClassFileVersion.of(8).MINOR); // Disassemble method and check if Java 8 API is used as expected JavaClass javaClass; 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 c1b0f8c44..abd9213f4 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Java17PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Java17PreviewFeaturesTests.java @@ -16,6 +16,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava17Only; * @author Alexander Kriegisch */ public class Java17PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava17Only { + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(17); public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { runTest("switch pattern matching error"); @@ -23,15 +24,15 @@ public class Java17PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava17Only public void testSwitchPatternMatchingJava() { runTest("switch pattern matching java"); - checkVersion("SwitchPatternOK", Constants.MAJOR_17, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternOK", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testSwitchPatternMatchingAspect() { runTest("switch pattern matching aspect"); - checkVersion("SwitchPatternAspect", Constants.MAJOR_17, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Application", Constants.MAJOR_17, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Shape", Constants.MAJOR_17, Constants.PREVIEW_MINOR_VERSION); - checkVersion("S", Constants.MAJOR_17, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternAspect", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); + checkVersion("Application", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); + checkVersion("Shape", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); + checkVersion("S", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public static Test suite() { 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 a9c247dad..10363e965 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java @@ -21,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava17OrLater; */ public class SanityTestsJava17 extends XMLBasedAjcTestCaseForJava17OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_17; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(17).MAJOR; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -73,7 +73,7 @@ public class SanityTestsJava17 extends XMLBasedAjcTestCaseForJava17OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", Constants.MAJOR_1_5, 0); + checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); } public static Test suite() { |