diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java b/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java index e3ab1110c6..4d79b72ad6 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java @@ -155,6 +155,11 @@ public class ClassFileVersion implements Comparable, Serializa */ public static final ClassFileVersion JAVA_V22 = new ClassFileVersion(Opcodes.V22); + /** + * The class file version of Java 23. + */ + public static final ClassFileVersion JAVA_V23 = new ClassFileVersion(Opcodes.V22 + 1); + /** * A version locator for the executing JVM. */ @@ -251,6 +256,8 @@ public static ClassFileVersion ofJavaVersionString(String javaVersionString) { return JAVA_V21; } else if (javaVersionString.equals("1.22") || javaVersionString.equals("22")) { return JAVA_V22; + } else if (javaVersionString.equals("1.23") || javaVersionString.equals("23")) { + return JAVA_V23; } else { if (OpenedClassReader.EXPERIMENTAL) { try { @@ -320,6 +327,8 @@ public static ClassFileVersion ofJavaVersion(int javaVersion) { return JAVA_V21; case 22: return JAVA_V22; + case 23: + return JAVA_V23; default: if (OpenedClassReader.EXPERIMENTAL && javaVersion > 0) { return new ClassFileVersion(BASE_VERSION + javaVersion); diff --git a/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionOtherTest.java b/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionOtherTest.java index 6352930af2..bb0b008fbd 100644 --- a/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionOtherTest.java +++ b/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionOtherTest.java @@ -70,7 +70,7 @@ public void testClassFile() throws Exception { @Test public void testThisVm() { - ClassFileVersion.ofThisVm(); + assertThat(ClassFileVersion.ofThisVm(), is(ClassFileVersion.ofThisVm())); } @Test diff --git a/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java b/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java index e62dd4ffe9..5d0cfef4bc 100644 --- a/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java +++ b/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java @@ -79,7 +79,8 @@ public static Collection data() { {19, 19, Arrays.asList("1.19", "19"), Opcodes.V19, (short) 63, (short) 0, true, true, true}, {20, 20, Arrays.asList("1.20", "20"), Opcodes.V20, (short) 64, (short) 0, true, true, true}, {21, 21, Arrays.asList("1.21", "21"), Opcodes.V21, (short) 65, (short) 0, true, true, true}, - {22, 22, Arrays.asList("1.22", "22"), Opcodes.V22, (short) 66, (short) 0, true, true, true} + {22, 22, Arrays.asList("1.22", "22"), Opcodes.V22, (short) 66, (short) 0, true, true, true}, + {23, 23, Arrays.asList("1.23", "23"), Opcodes.V22 + 1, (short) 67, (short) 0, true, true, true} }); } diff --git a/pom.xml b/pom.xml index a316a6bed1..d1431d527c 100644 --- a/pom.xml +++ b/pom.xml @@ -765,6 +765,21 @@ true + + + java23-compatibility + + false + 23 + + + 8 + 8 + 8 + 8 + true + + java6 @@ -956,6 +971,18 @@ true + + + java23 + + false + + + 23 + 23 + true + + surefire-enable-dynamic-attach