Skip to content

Commit

Permalink
Support up to Java version 23
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Jul 15, 2024
1 parent 7f9e183 commit 0c7f2dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -31,6 +33,8 @@ private Constants() {
Opcodes.V19,
Opcodes.V20,
Opcodes.V21,
Opcodes.V22,
Opcodes.V23,
};

public static final int ASM_VERSION = Opcodes.ASM9;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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() {
Expand All @@ -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();
Expand Down

0 comments on commit 0c7f2dd

Please sign in to comment.