Skip to content

Commit

Permalink
Update to current pxb1988 version
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Sep 1, 2023
2 parents 994ced1 + d90f4ef commit bfa6a96
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 222 deletions.
205 changes: 0 additions & 205 deletions checkstyle.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ private Constants() {
Opcodes.V15,
Opcodes.V16,
Opcodes.V17,
Opcodes.V18
Opcodes.V18,
Opcodes.V19,
Opcodes.V20,
Opcodes.V21,
};

public static final int ASM_VERSION = Opcodes.ASM9;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ 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~18], default 8 for JAVA8")
@Opt(opt = "cv", longOpt = "class-version", description = "default .class version, [1~21], default 8 for JAVA8")
private int classVersion = 8;

public Jasmin2JarCmd() {
}

public static void main(String... args) throws SecurityException {
public static void main(String... args) throws ClassNotFoundException, SecurityException {
new Jasmin2JarCmd().doMain(args);
}

Expand All @@ -62,8 +62,9 @@ protected void doCommandLine() throws Exception {
usage();
return;
}
if (classVersion < 1 || classVersion > 18) {
throw new HelpException("-cv,--class-version out of range, 1-18 is supported.");
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.");
}

Path jar = new File(remainingArgs[0]).toPath().toAbsolutePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ public void dump(ClassNode cn) {

for (FieldNode fn : cn.fields) {
boolean annotations = fn.visibleAnnotations != null && !fn.visibleAnnotations.isEmpty();
if (fn.invisibleAnnotations != null && !fn.invisibleAnnotations.isEmpty()) {
annotations = true;
}
boolean deprecated = (fn.access & Opcodes.ACC_DEPRECATED) != 0;
pw.print("\n.field");
pw.print(accessFld(fn.access));
Expand Down Expand Up @@ -379,6 +376,11 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc,
pw.println();
}

@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
visitMethodInsn(opcode, owner, name, desc, opcode == INVOKEINTERFACE);
}

@Override
public void visitJumpInsn(int opcode, Label label) {
print(opcode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static ClassNode parse(Path file) throws IOException {
try (BufferedReader bufferedReader = Files.newBufferedReader(file, StandardCharsets.UTF_8)) {
return parse(file.toString(), bufferedReader);
} catch (RecognitionException e) {
throw new RuntimeException("Fail to assemble " + file, e);
throw new RuntimeException("Failed to assemble " + file, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public static String unEscape0(String str, int start, int end) {
}
}
if (x == 0) {
throw new RuntimeException("can't pase string");
throw new RuntimeException("Can't parse string");
}
sb.append((char) Integer.parseInt(str.substring(i + 1, i + 1 + x), 8));
i += 1 + x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1196,8 +1196,7 @@ static class BadOpException extends RuntimeException {
}

private void findLabels(byte[] insns, BitSet nextBit, BitSet badOps, Map<Integer, DexLabel> labelsMap,
Set<Integer> handlers,
Method method) {
Set<Integer> handlers, Method method) {
Queue<Integer> q = new LinkedList<>();
q.add(0);
q.addAll(handlers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc,
}
}

@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
visitMethodInsn(opcode, owner, name, desc, opcode == INVOKEINTERFACE);
}
}

};
Expand Down
14 changes: 9 additions & 5 deletions dex-translator/src/main/java/com/googlecode/d2j/dex/Dex2Asm.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,18 @@ void addInner(Clz clz) {

@Override
public boolean equals(Object o) {
if (this == o) {
if (this == o)
return true;
}
if (!(o instanceof Clz)) {
if (o == null)
return false;
if (getClass() != o.getClass())
return false;
Clz other = (Clz) o;
if (name == null) {
return other.name == null;
} else {
return name.equals(other.name);
}
Clz clz = (Clz) o;
return Objects.equals(name, clz.name);
}

@Override
Expand Down

0 comments on commit bfa6a96

Please sign in to comment.