diff --git a/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/Constants.java b/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/Constants.java index 207d5851..d0322adb 100644 --- a/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/Constants.java +++ b/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/Constants.java @@ -8,6 +8,8 @@ private Constants() { throw new UnsupportedOperationException(); } + public static final int MAX_JAVA_VERSION = 23; + public static final int[] JAVA_VERSIONS = new int[]{ 0, Opcodes.V1_1, @@ -31,6 +33,8 @@ private Constants() { Opcodes.V19, Opcodes.V20, Opcodes.V21, + Opcodes.V22, + Opcodes.V23, }; public static final int ASM_VERSION = Opcodes.ASM9; diff --git a/d2j-jasmin/src/main/java/com/googlecode/d2j/jasmin/Jasmin2JarCmd.java b/d2j-jasmin/src/main/java/com/googlecode/d2j/jasmin/Jasmin2JarCmd.java index ed26c968..13694f9d 100644 --- a/d2j-jasmin/src/main/java/com/googlecode/d2j/jasmin/Jasmin2JarCmd.java +++ b/d2j-jasmin/src/main/java/com/googlecode/d2j/jasmin/Jasmin2JarCmd.java @@ -34,7 +34,8 @@ public class Jasmin2JarCmd extends BaseCmd implements Opcodes { private boolean forceOverwrite = false; @Opt(opt = "o", longOpt = "output", description = "output .jar file, default is " - + "$current_dir/[jar-name]-jasmin2jar.jar", argName = "out-jar-file") + + "$current_dir/[jar-name]-jasmin2jar.jar", + argName = "out-jar-file") private Path output; @Opt(opt = "e", longOpt = "encoding", description = "encoding for .j files, default is UTF-8", argName = "enc") @@ -46,7 +47,8 @@ public class Jasmin2JarCmd extends BaseCmd implements Opcodes { @Opt(longOpt = "no-compute-max", description = "", hasArg = false) private boolean noComputeMax; - @Opt(opt = "cv", longOpt = "class-version", description = "default .class version, [1~21], default 8 for JAVA8") + @Opt(opt = "cv", longOpt = "class-version", description = "default .class version, [1~" + + Constants.MAX_JAVA_VERSION + "], default 8 for JAVA8") private int classVersion = 8; public Jasmin2JarCmd() { @@ -62,9 +64,9 @@ protected void doCommandLine() throws Exception { usage(); return; } - int maxClassVersion = Constants.JAVA_VERSIONS.length - 1; - if (classVersion < 1 || classVersion > maxClassVersion) { - throw new HelpException("-cv,--class-version out of range, 1-" + maxClassVersion + " is supported."); + if (classVersion < 1 || classVersion > Constants.MAX_JAVA_VERSION) { + throw new HelpException("-cv,--class-version out of range, 1-" + Constants.MAX_JAVA_VERSION + + " is supported."); } Path jar = new File(remainingArgs[0]).toPath().toAbsolutePath();