From f3450726d21518bd51deaf46629682d328bb3338 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Mon, 19 Feb 2024 13:19:49 +0700 Subject: [PATCH] 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 --- .../org/aspectj/apache/bcel/Constants.java | 133 +++++++++++------- .../bcel/classfile/tests/ModuleTest.java | 4 +- .../systemtest/ajc160/SanityTests.java | 4 +- .../systemtest/ajc190/SanityTests19.java | 4 +- .../systemtest/ajc191/SanityTestsJava10.java | 4 +- .../ajc1919/Java19PreviewFeaturesTests.java | 11 +- .../systemtest/ajc1919/SanityTestsJava19.java | 4 +- .../systemtest/ajc192/SanityTestsJava11.java | 4 +- .../ajc1920/Java20PreviewFeaturesTests.java | 15 +- .../systemtest/ajc1920/SanityTestsJava20.java | 4 +- .../systemtest/ajc1921/Ajc1921TestsJava.java | 14 +- .../systemtest/ajc1921/SanityTestsJava21.java | 4 +- .../systemtest/ajc195/SanityTestsJava13.java | 4 +- .../systemtest/ajc196/Ajc196Tests.java | 6 +- .../ajc196/Java14PreviewFeaturesTests.java | 3 +- .../systemtest/ajc196/SanityTestsJava14.java | 4 +- .../systemtest/ajc197/Ajc197TestsJava.java | 14 +- .../ajc197/Java16PreviewFeaturesTests.java | 9 +- .../systemtest/ajc197/SanityTestsJava15.java | 4 +- .../systemtest/ajc197/SanityTestsJava16.java | 4 +- .../systemtest/ajc198/Ajc198TestsJava.java | 8 +- .../ajc198/CompileWithReleaseTests.java | 2 +- .../ajc198/Java17PreviewFeaturesTests.java | 11 +- .../systemtest/ajc198/SanityTestsJava17.java | 4 +- .../ajc199/Java18PreviewFeaturesTests.java | 17 +-- .../systemtest/ajc199/SanityTestsJava18.java | 4 +- 26 files changed, 167 insertions(+), 132 deletions(-) diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java index 5b96bb6d1..566133f17 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java @@ -2,6 +2,10 @@ package org.aspectj.apache.bcel; import org.aspectj.apache.bcel.generic.Type; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -63,58 +67,83 @@ import org.aspectj.apache.bcel.generic.Type; * @author Andy Clement */ public interface Constants { - // Major and minor version of the code - short MAJOR_1_1 = 45; - short MINOR_1_1 = 3; - short MAJOR_1_2 = 46; - short MINOR_1_2 = 0; - short MAJOR_1_3 = 47; - short MINOR_1_3 = 0; - short MAJOR_1_4 = 48; - short MINOR_1_4 = 0; - short MAJOR_1_5 = 49; - short MINOR_1_5 = 0; - short MAJOR_1_6 = 50; - short MINOR_1_6 = 0; - short MAJOR_1_7 = 51; - short MINOR_1_7 = 0; - short MAJOR_1_8 = 52; - short MINOR_1_8 = 0; - short MAJOR_1_9 = 53; - short MINOR_1_9 = 0; - short MAJOR_10 = 54; - short MINOR_10 = 0; - short MAJOR_11 = 55; - short MINOR_11 = 0; - short MAJOR_12 = 56; - short MINOR_12 = 0; - short MAJOR_13 = 57; - short MINOR_13 = 0; - short MAJOR_14 = 58; - short MINOR_14 = 0; - short MAJOR_15 = 59; - short MINOR_15 = 0; - short MAJOR_16 = 60; - short MINOR_16 = 0; - short MAJOR_17 = 61; - short MINOR_17 = 0; - short MAJOR_18 = 62; - short MINOR_18 = 0; - short MAJOR_19 = 63; - short MINOR_19 = 0; - short MAJOR_20 = 64; - short MINOR_20 = 0; - short MAJOR_21 = 65; - short MINOR_21 = 0; - // AspectJ_JDK_Update -// short MAJOR_22 = 66; -// short MINOR_22 = 0; - - int PREVIEW_MINOR_VERSION = 65535; - - // Defaults - short MAJOR = MAJOR_1_1; - short MINOR = MINOR_1_1; + // Selected major/minor class file versions, defined as constants because they are used in production code. Maybe, + // there is a slight performance advantage, therefore retain them. When tests need class file version infos, they + // should use ClassFileVersion.of(javaMajor) instead, avoiding new constants for every major Java release. In the + // past, we had too many of them. + int MAJOR_1_1 = 45; + int MINOR_1_1 = 3; + int MAJOR_1_5 = 49; + int MAJOR_1_6 = 50; + int MAJOR_1_8 = 52; + + /** + * Carries information about major, minor and preview-minor version byte values found in Java class files for a + * specific Java version. You can obtain instances via {@link #of(int)} and {@link #of(int, int)}, respectively. + */ + class ClassFileVersion { + private static final Map cache = new ConcurrentHashMap<>(); + + public final int MAJOR; + public final int MINOR; + public final int PREVIEW_MINOR = 65535; + + private ClassFileVersion(int major, int minor) { + MAJOR = major; + MINOR = minor; + } + + /** + * Obtain a class file version info instance for a specific Java version + * + * @param javaMajor Java major version; must be >= 2; values 2 to 9 are interpreted as Java versions 1.2 to 1.9 + * + * @return either a cached or a new instance; result is identical to calling {@code of(javaMajor, 0)} + */ + public static ClassFileVersion of(int javaMajor) { + return of(javaMajor, 0); + } + + /** + * Obtain a class file version info instance for a specific Java version + * + * @param javaMajor Java major version; must be >= 1; values 2 to 9 are interpreted as Java versions 1.2 to 1.9 + * @param javaMinor Java minor version; is only relevant for Java major 1 and must be in range [1..9] + * + * @return either a cached or a new instance + */ + public static ClassFileVersion of(int javaMajor, int javaMinor) { + if (javaMajor < 1) + throw new IllegalArgumentException("Java major version must be >= 1"); + if (javaMajor == 1) { + if (javaMinor < 1 || javaMinor > 9) + throw new IllegalArgumentException("Java 1.x versions must be 1.1 to 1.9"); + // 1.1 -> 1, ..., 1.5 -> 5, ..., 1.9 -> 9 + javaMajor = javaMinor; + } + ClassFileVersion classFileVersion = cache.get(javaMajor); + if (classFileVersion == null) { + classFileVersion = new ClassFileVersion(javaMajor + 44, javaMajor == 1 ? 3 : 0); + cache.put(javaMajor, classFileVersion); + } + return classFileVersion; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ClassFileVersion)) return false; + ClassFileVersion that = (ClassFileVersion) o; + // Include PREVIEW_MINOR, if it ever changes to be non-constant + return MAJOR == that.MAJOR && MINOR == that.MINOR /*&& PREVIEW_MINOR == that.PREVIEW_MINOR*/; + } + + @Override + public int hashCode() { + // Include PREVIEW_MINOR, if it ever changes to be non-constant + return Objects.hash(MAJOR, MINOR/*, PREVIEW_MINOR*/); + } + } /** Maximum value for an unsigned short */ int MAX_SHORT = 65535; // 2^16 - 1 diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java index f8012a983..b52c89e4f 100644 --- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java +++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java @@ -36,8 +36,8 @@ public class ModuleTest extends BcelTestCase { ClassParser classParser = new ClassParser(moduleFilename); JavaClass javaClass = classParser.parse(); assertNotNull(javaClass); - assertEquals(Constants.MAJOR_1_9,javaClass.getMajor()); - assertEquals(Constants.MINOR_1_9,javaClass.getMinor()); + assertEquals(Constants.ClassFileVersion.of(9).MAJOR, javaClass.getMajor()); + assertEquals(Constants.ClassFileVersion.of(9).MINOR, javaClass.getMinor()); assertEquals(Constants.ACC_MODULE,javaClass.getModifiers()); assertEquals(0,javaClass.getSuperclassNameIndex()); assertEquals(0,javaClass.getInterfaceIndices().length); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java index 4a7c39a01..619114dfa 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java @@ -26,7 +26,7 @@ import junit.framework.Test; * rather than executing them. */ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_1_6; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(6).MAJOR; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -83,7 +83,7 @@ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testVersionCorrect4() throws ClassNotFoundException {// check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", Constants.MAJOR_1_5, 0); + checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); } // Check the stackmap stuff appears for methods in a Java6 file 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 ac5b109e6..38678b750 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java @@ -21,7 +21,7 @@ import junit.framework.Test; * to check code generation and modification with that version specified. */ public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_1_9; + 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) public void testSimpleJava_A() { @@ -73,7 +73,7 @@ public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", Constants.MAJOR_1_5, 0); + checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); } // Check the stackmap stuff appears for methods in a Java6 file 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 5d5a04564..79c6ba1ae 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java @@ -20,7 +20,7 @@ import junit.framework.Test; * @author Andy Clement */ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_10; + 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) public void testSimpleJava_A() { @@ -71,7 +71,7 @@ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", Constants.MAJOR_1_5, 0); + checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); } // /////////////////////////////////////// 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 b4dc12f39..1207f5cc6 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java @@ -16,18 +16,19 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava19Only; * @author Alexander Kriegisch */ public class Java19PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava19Only { + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(19); public void testSwitchPatternMatchingPreview3Java() { runTest("switch pattern matching preview 3 java"); - checkVersion("SwitchPatternPreview3OK", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternPreview3OK", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testSwitchPatternMatchingPreview3Aspect() { runTest("switch pattern matching preview 3 aspect"); - checkVersion("SwitchPatternPreview3Aspect", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Application", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Shape", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); - checkVersion("S", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternPreview3Aspect", 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 void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { 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 a8a3826ea..9f70c3ff2 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java @@ -21,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; */ public class SanityTestsJava19 extends XMLBasedAjcTestCaseForJava19OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_19; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(19).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 SanityTestsJava19 extends XMLBasedAjcTestCaseForJava19OrLater { 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() { 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 b0f2cdb67..e0b9034f8 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java @@ -21,7 +21,7 @@ import junit.framework.Test; * @author Andy Clement */ public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_11; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(11).MAJOR; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +72,7 @@ public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", Constants.MAJOR_1_5, 0); + checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); } 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 89a0a61c6..1a305bce1 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java @@ -16,10 +16,11 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava20Only; * @author Alexander Kriegisch */ public class Java20PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava20Only { + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(20); public void testSwitchPatternMatchingPreview4Java() { runTest("switch pattern matching preview 4 java"); - checkVersion("SwitchPatternPreview4OK", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternPreview4OK", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testSwitchPatternMatchingPreview4Error() { @@ -28,10 +29,10 @@ public class Java20PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava20Only public void testSwitchPatternMatchingPreview3Aspect() { runTest("switch pattern matching preview 3 aspect"); - checkVersion("SwitchPatternPreview3Aspect", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Application", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Shape", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); - checkVersion("S", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternPreview3Aspect", 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 void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { @@ -54,8 +55,8 @@ public class Java20PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava20Only 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.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Box", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); + checkVersion("RecordPatternsPreview1Error", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); + checkVersion("Box", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testRecordPatternsPreview1ExhaustivenessOK1() { 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 88b9670e9..6cd0fd6b7 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java @@ -21,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava20OrLater; */ public class SanityTestsJava20 extends XMLBasedAjcTestCaseForJava20OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_20; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(20).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 SanityTestsJava20 extends XMLBasedAjcTestCaseForJava20OrLater { 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() { 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 b0eaf3939..466135dc2 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java @@ -19,7 +19,7 @@ public class Ajc1921TestsJava extends XMLBasedAjcTestCaseForJava21OrLater { public void testSwitchPatternMatchingPreview4Java() { runTest("switch pattern matching preview 4 java"); - checkVersion("SwitchPatternPreview4OK", Constants.MAJOR_21, Constants.MINOR_21); + checkVersion("SwitchPatternPreview4OK", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); } public void testSwitchPatternMatchingPreview4Error() { @@ -28,10 +28,10 @@ public class Ajc1921TestsJava extends XMLBasedAjcTestCaseForJava21OrLater { public void testSwitchPatternMatchingPreview3Aspect() { runTest("switch pattern matching preview 3 aspect"); - checkVersion("SwitchPatternPreview3Aspect", Constants.MAJOR_21, Constants.MINOR_21); - checkVersion("Application", Constants.MAJOR_21, Constants.MINOR_21); - checkVersion("Shape", Constants.MAJOR_21, Constants.MINOR_21); - checkVersion("S", Constants.MAJOR_21, Constants.MINOR_21); + 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); } public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { @@ -54,8 +54,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.MAJOR_21, Constants.MINOR_21); - checkVersion("Box", Constants.MAJOR_21, Constants.MINOR_21); + checkVersion("RecordPatternsPreview1Error", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); + checkVersion("Box", Constants.ClassFileVersion.of(21).MAJOR, Constants.ClassFileVersion.of(21).MINOR); } public void testRecordPatternsPreview1ExhaustivenessOK1() { 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 ed2216fdb..2f4810e4e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java @@ -21,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater; */ public class SanityTestsJava21 extends XMLBasedAjcTestCaseForJava21OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_21; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(21).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 SanityTestsJava21 extends XMLBasedAjcTestCaseForJava21OrLater { 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() { 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 54397cf2f..34901eb00 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java @@ -22,7 +22,7 @@ import junit.framework.Test; */ public class SanityTestsJava13 extends XMLBasedAjcTestCaseForJava13OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_13; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(13).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 SanityTestsJava13 extends XMLBasedAjcTestCaseForJava13OrLater { public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", Constants.MAJOR_1_5, 0); + checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0); } 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 1669f7956..5659b2931 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java @@ -24,17 +24,17 @@ public class Ajc196Tests extends XMLBasedAjcTestCaseForJava14OrLater { public void testSwitch1() { runTest("switch 1"); - checkVersion("Switch1", Constants.MAJOR_14, 0); + checkVersion("Switch1", Constants.ClassFileVersion.of(14).MAJOR, 0); } public void testSwitch2() { runTest("switch 2"); - checkVersion("Switch2", Constants.MAJOR_14, 0); + checkVersion("Switch2", Constants.ClassFileVersion.of(14).MAJOR, 0); } public void testSwitch3() { runTest("switch 3"); - checkVersion("Switch3", Constants.MAJOR_14, 0); + checkVersion("Switch3", Constants.ClassFileVersion.of(14).MAJOR, 0); } public static Test 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 6c31f0af2..24b02101e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java @@ -17,10 +17,11 @@ import junit.framework.Test; * @author Alexander Kriegisch */ public class Java14PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava14Only { + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(14); public void testRecords() { runTest("simple record"); - checkVersion("Person", Constants.MAJOR_14, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Person", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testRecords2() { 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 960ba4420..13094e048 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java @@ -22,7 +22,7 @@ import junit.framework.Test; */ public class SanityTestsJava14 extends XMLBasedAjcTestCaseForJava14OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_14; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(14).MAJOR; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -74,7 +74,7 @@ public class SanityTestsJava14 extends XMLBasedAjcTestCaseForJava14OrLater { 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() { 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 5e18926fc..8a1f794f4 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java @@ -19,37 +19,37 @@ public class Ajc197TestsJava extends XMLBasedAjcTestCaseForJava16OrLater { public void testHiddenClass() { runTest("hidden class"); - checkVersion("HiddenClassDemo", Constants.MAJOR_16, Constants.MINOR_16); + checkVersion("HiddenClassDemo", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); } public void testTextBlock1() { runTest("textblock 1"); - checkVersion("Code", Constants.MAJOR_16, Constants.MINOR_16); + checkVersion("Code", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); } public void testTextBlock2() { runTest("textblock 2"); - checkVersion("Code2", Constants.MAJOR_16, Constants.MINOR_16); + checkVersion("Code2", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); } public void testRecords() { runTest("simple record"); - checkVersion("Person", Constants.MAJOR_16, Constants.MINOR_16); + checkVersion("Person", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); } public void testRecords2() { runTest("using a record"); - checkVersion("UsingPersonRecord", Constants.MAJOR_16, Constants.MINOR_16); + checkVersion("UsingPersonRecord", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); } public void testAdvisingRecords() { runTest("advising records"); - checkVersion("TraceRecordComponents", Constants.MAJOR_16, Constants.MINOR_16); + checkVersion("TraceRecordComponents", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); } public void testInstanceofPatterns() { runTest("instanceof patterns"); - checkVersion("Jep305", Constants.MAJOR_16, Constants.MINOR_16); + checkVersion("Jep305", Constants.ClassFileVersion.of(16).MAJOR, Constants.ClassFileVersion.of(16).MINOR); } public static Test 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 dbcbcf06a..f2c04e08c 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java @@ -16,21 +16,22 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava16Only; * @author Alexander Kriegisch */ public class Java16PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava16Only { + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(16); public void testSealedClassWithLegalSubclasses() { runTest("sealed class with legal subclasses"); - checkVersion("Employee", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Manager", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Employee", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); + checkVersion("Manager", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testSealedClassWithIllegalSubclass() { runTest("sealed class with illegal subclass"); - checkVersion("Person", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Person", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testWeaveSealedClass() { runTest("weave sealed class"); - checkVersion("PersonAspect", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION); + checkVersion("PersonAspect", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public static Test suite() { 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 a7ee41d5f..d244ebea7 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java @@ -21,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava15OrLater; */ public class SanityTestsJava15 extends XMLBasedAjcTestCaseForJava15OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_15; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(15).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 SanityTestsJava15 extends XMLBasedAjcTestCaseForJava15OrLater { 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() { 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 185660b15..1e42ce6d7 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java @@ -21,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava16OrLater; */ public class SanityTestsJava16 extends XMLBasedAjcTestCaseForJava16OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_16; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(16).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 SanityTestsJava16 extends XMLBasedAjcTestCaseForJava16OrLater { 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() { 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() { 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 8afe68946..078a47671 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java @@ -16,6 +16,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava18Only; * @author Alexander Kriegisch */ public class Java18PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava18Only { + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(18); public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { runTest("switch pattern matching error"); @@ -23,15 +24,15 @@ public class Java18PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava18Only public void testSwitchPatternMatchingJava() { runTest("switch pattern matching java"); - checkVersion("SwitchPatternOK", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternOK", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testSwitchPatternMatchingAspect() { runTest("switch pattern matching aspect"); - checkVersion("SwitchPatternAspect", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Application", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Shape", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); - checkVersion("S", Constants.MAJOR_18, 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 void testSwitchPatternMatchingPreview2Error1() { @@ -44,13 +45,13 @@ public class Java18PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava18Only public void testSwitchPatternMatchingPreview2Java() { runTest("switch pattern matching preview 2 java"); - checkVersion("SwitchPatternPreview2OK", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternPreview2OK", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public void testSwitchPatternMatchingPreview2Aspect() { runTest("switch pattern matching preview 2 aspect"); - checkVersion("SwitchPatternPreview2Aspect", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); - checkVersion("Application", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + checkVersion("SwitchPatternPreview2Aspect", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); + checkVersion("Application", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR); } public static Test suite() { 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 a4c8ee9e2..e2d308ab5 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java @@ -21,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; */ public class SanityTestsJava18 extends XMLBasedAjcTestCaseForJava18OrLater { - public static final int bytecode_version_for_JDK_level = Constants.MAJOR_18; + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(18).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 SanityTestsJava18 extends XMLBasedAjcTestCaseForJava18OrLater { 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() { -- 2.39.5