Skip to content

Commit

Permalink
Merge pull request pxb1988#11 from ThexXTURBOXx/develop
Browse files Browse the repository at this point in the history
Fix some possible issues everywhere
  • Loading branch information
ThexXTURBOXx authored Oct 4, 2021
2 parents 2b398e6 + 22abca5 commit 145f112
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -870,19 +870,19 @@ protected void printAnnotationArrayValue(final Object value) {
}

protected void printFrameType(final Object type) {
if (type == Opcodes.TOP) {
if (Opcodes.TOP.equals(type)) {
pw.print("Top");
} else if (type == Opcodes.INTEGER) {
} else if (Opcodes.INTEGER.equals(type)) {
pw.print("Integer");
} else if (type == Opcodes.FLOAT) {
} else if (Opcodes.FLOAT.equals(type)) {
pw.print("Float");
} else if (type == Opcodes.LONG) {
} else if (Opcodes.LONG.equals(type)) {
pw.print("Long");
} else if (type == Opcodes.DOUBLE) {
} else if (Opcodes.DOUBLE.equals(type)) {
pw.print("Double");
} else if (type == Opcodes.NULL) {
} else if (Opcodes.NULL.equals(type)) {
pw.print("Null");
} else if (type == Opcodes.UNINITIALIZED_THIS) {
} else if (Opcodes.UNINITIALIZED_THIS.equals(type)) {
pw.print("UninitializedThis");
} else if (type instanceof Label) {
pw.print("Uninitialized ");
Expand Down
4 changes: 2 additions & 2 deletions dex-ir/src/main/java/com/googlecode/dex2jar/ir/TypeClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public enum TypeClass {
IF("i"), //
JD("w"); //

public String name;
public boolean fixed;
public final String name;
public final boolean fixed;

TypeClass(String use, boolean fixed) {
this.name = use;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public enum Visibility {

BUILD(0), RUNTIME(1), SYSTEM(2);

public int value;
public final int value;

// int VISIBILITY_BUILD = 0;
// int VISIBILITY_RUNTIME = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public enum InstructionFormat {

// kFmt3rmi(3), // [opt] inline invoke/range

public int size;
public final int size;

InstructionFormat(int size) {
this.size = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,19 @@ public enum Op implements CFG {
K_INSTR_CAN_CONTINUE | K_INSTR_CAN_THROW | K_INSTR_INVOKE, true), //
BAD_OP(-1, "bad-opcode", null, kIndexNone, 0, false); //

public int opcode;
public final int opcode;

public InstructionFormat format;
public final InstructionFormat format;

/* package */ InstructionIndexType indexType;

/* package */ int flags;

public String displayName;
public final String displayName;

public static final Op[] OPS = new Op[256];

public boolean changeFrame;
public final boolean changeFrame;

static {
for (Op op : Op.values()) {
Expand Down Expand Up @@ -340,6 +340,7 @@ public boolean canThrow() {
this.format = fmt;
this.indexType = indexType;
this.flags = flags;
this.changeFrame = changeFrame;
}

public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;

public class ClassInfo {
Expand All @@ -17,8 +18,16 @@ public ClassInfo(String name) {
this.name = name;
}

@Override
public boolean equals(Object o) {
return name.equals(((ClassInfo) o).name);
if (this == o) {
return true;
}
if (!(o instanceof ClassInfo)) {
return false;
}
ClassInfo classInfo = (ClassInfo) o;
return Objects.equals(name, classInfo.name);
}

public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.googlecode.dex2jar.tools.BaseCmd;
import com.googlecode.dex2jar.tools.Constants;
import java.io.IOException;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.Files;
Expand Down Expand Up @@ -448,7 +449,7 @@ private static class MemberInfo {

}

private static class MemberInfoComparator implements Comparator<MemberInfo> {
private static class MemberInfoComparator implements Comparator<MemberInfo>, Serializable {

@Override
public int compare(MemberInfo memberInfo, MemberInfo memberInfo2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected void doCommandLine() throws Exception {
return;
}

System.err.printf("fix %s -> %s\n", remainingArgs[0], output);
System.err.printf("fix %s -> %s%n", remainingArgs[0], output);

byte[] buffer = new byte[1000];
try (ZipOutputStream zos = new AutoSTOREDZipOutputStream(Files.newOutputStream(output))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String... strings) throws IllegalArgumentException, Ille
for (Field f : SectionItem.class.getFields()) {
if (f.getType().equals(int.class)) {
if (0 != (f.getModifiers() & Modifier.STATIC)) {
System.out.printf("%s(0x%04x,0,0),//\n", f.getName(), f.get(null));
System.out.printf("%s(0x%04x,0,0),//%n", f.getName(), f.get(null));
}
}
}
Expand Down Expand Up @@ -109,9 +109,9 @@ public enum SectionType {
TYPE_ENCODED_ARRAY_ITEM(0x2005, 1, 0), //
TYPE_ANNOTATIONS_DIRECTORY_ITEM(0x2006, 4, 0); //

public int code;
public final int code;

public int alignment;
public final int alignment;

SectionType(int typeCode, int alignment, int size) {
this.code = typeCode;
Expand Down

0 comments on commit 145f112

Please sign in to comment.