From 131d118f841abf89a44fec86c76849ecce643d7f Mon Sep 17 00:00:00 2001 From: forax Date: Sat, 18 Jun 2022 17:34:51 +0200 Subject: [PATCH] recognize Java 10 version (64) --- asm-util/src/main/java/org/objectweb/asm/util/ASMifier.java | 1 + asm/src/main/java/org/objectweb/asm/ClassReader.java | 2 +- asm/src/main/java/org/objectweb/asm/Opcodes.java | 1 + asm/src/test/java/org/objectweb/asm/ConstantsTest.java | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/asm-util/src/main/java/org/objectweb/asm/util/ASMifier.java b/asm-util/src/main/java/org/objectweb/asm/util/ASMifier.java index 51134811c..2d1966a5e 100644 --- a/asm-util/src/main/java/org/objectweb/asm/util/ASMifier.java +++ b/asm-util/src/main/java/org/objectweb/asm/util/ASMifier.java @@ -109,6 +109,7 @@ public class ASMifier extends Printer { classVersions.put(Opcodes.V17, "V17"); classVersions.put(Opcodes.V18, "V18"); classVersions.put(Opcodes.V19, "V19"); + classVersions.put(Opcodes.V20, "V20"); CLASS_VERSIONS = Collections.unmodifiableMap(classVersions); } diff --git a/asm/src/main/java/org/objectweb/asm/ClassReader.java b/asm/src/main/java/org/objectweb/asm/ClassReader.java index 413f2a1a3..2a1139c32 100644 --- a/asm/src/main/java/org/objectweb/asm/ClassReader.java +++ b/asm/src/main/java/org/objectweb/asm/ClassReader.java @@ -194,7 +194,7 @@ public class ClassReader { this.b = classFileBuffer; // Check the class' major_version. This field is after the magic and minor_version fields, which // use 4 and 2 bytes respectively. - if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V19) { + if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V20) { throw new IllegalArgumentException( "Unsupported class file major version " + readShort(classFileOffset + 6)); } diff --git a/asm/src/main/java/org/objectweb/asm/Opcodes.java b/asm/src/main/java/org/objectweb/asm/Opcodes.java index c4d1679a6..4a85a445e 100644 --- a/asm/src/main/java/org/objectweb/asm/Opcodes.java +++ b/asm/src/main/java/org/objectweb/asm/Opcodes.java @@ -285,6 +285,7 @@ public interface Opcodes { int V17 = 0 << 16 | 61; int V18 = 0 << 16 | 62; int V19 = 0 << 16 | 63; + int V20 = 0 << 16 | 64; /** * Version flag indicating that the class is using 'preview' features. diff --git a/asm/src/test/java/org/objectweb/asm/ConstantsTest.java b/asm/src/test/java/org/objectweb/asm/ConstantsTest.java index 8c2208618..f2ca92a2f 100644 --- a/asm/src/test/java/org/objectweb/asm/ConstantsTest.java +++ b/asm/src/test/java/org/objectweb/asm/ConstantsTest.java @@ -252,6 +252,7 @@ class ConstantsTest { case "V17": case "V18": case "V19": + case "V20": return ConstantType.CLASS_VERSION; case "ACC_PUBLIC": case "ACC_PRIVATE": -- GitLab