mirror of
https://github.com/pxb1988/dex2jar.git
synced 2024-11-23 13:19:46 +00:00
fix compiler warnings
--HG-- branch : 2.x
This commit is contained in:
parent
6469f08a74
commit
fa54e82162
@ -16,21 +16,17 @@
|
||||
*/
|
||||
package com.googlecode.d2j.jasmin;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.googlecode.dex2jar.tools.BaseCmd;
|
||||
import com.googlecode.dex2jar.tools.BaseCmd.Syntax;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import com.googlecode.dex2jar.tools.BaseCmd.Syntax;
|
||||
import java.io.*;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
|
||||
@Syntax(cmd = "d2j-jar2jasmin", syntax = "[options] <jar>", desc = "Disassemble .class in jar file to jasmin file", onlineHelp = "https://code.google.com/p/dex2jar/wiki/Jasmin")
|
||||
public class Jar2JasminCmd extends BaseCmd {
|
||||
@ -43,7 +39,7 @@ public class Jar2JasminCmd extends BaseCmd {
|
||||
@Opt(opt = "e", longOpt = "encoding", description = "encoding for .j files, default is UTF-8", argName = "enc")
|
||||
private String encoding = "UTF-8";
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new Jar2JasminCmd().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -16,18 +16,7 @@
|
||||
*/
|
||||
package com.googlecode.d2j.jasmin;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.googlecode.dex2jar.tools.BaseCmd;
|
||||
import org.antlr.runtime.ANTLRReaderStream;
|
||||
import org.antlr.runtime.ANTLRStringStream;
|
||||
import org.antlr.runtime.CommonTokenStream;
|
||||
@ -36,7 +25,14 @@ import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import com.googlecode.dex2jar.tools.BaseCmd;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
|
||||
@BaseCmd.Syntax(cmd = "d2j-jasmin2jar", syntax = "[options] <jar>", desc = "Assemble .j files to .class file", onlineHelp = "https://code.google.com/p/dex2jar/wiki/Jasmin")
|
||||
public class Jasmin2JarCmd extends BaseCmd implements Opcodes {
|
||||
@ -58,7 +54,7 @@ public class Jasmin2JarCmd extends BaseCmd implements Opcodes {
|
||||
@Opt(opt = "cv", longOpt = "class-version", description = "default .class version, [1~9], default 6 for JAVA6")
|
||||
private int classVersion = 6;
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException, SecurityException {
|
||||
public static void main(String... args) throws ClassNotFoundException, SecurityException {
|
||||
new Jasmin2JarCmd().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ public class JasminDumper implements Opcodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) {
|
||||
public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
|
||||
pw.print("tableswitch ");
|
||||
pw.println(min);
|
||||
for (Label label : labels) {
|
||||
|
@ -5,7 +5,6 @@ import com.googlecode.d2j.visitors.DexClassVisitor;
|
||||
import com.googlecode.d2j.visitors.DexFileVisitor;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package a;
|
||||
|
||||
import com.googlecode.d2j.dex.writer.DexFileWriter;
|
||||
import com.googlecode.d2j.node.DexClassNode;
|
||||
import com.googlecode.d2j.node.DexFileNode;
|
||||
import com.googlecode.d2j.smali.BaksmaliDumpOut;
|
||||
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||
|
||||
import com.googlecode.dex2jar.ir.expr.Local;
|
||||
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.StmtList;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.googlecode.dex2jar.ir;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.googlecode.dex2jar.ir.expr.Local;
|
||||
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.googlecode.dex2jar.ir;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
|
||||
|
||||
/**
|
||||
|
@ -118,6 +118,7 @@ public enum TypeClass {
|
||||
|
||||
case JD:
|
||||
throw new RuntimeException();
|
||||
default:
|
||||
}
|
||||
case ZIFL:
|
||||
switch (clz) {
|
||||
@ -129,6 +130,7 @@ public enum TypeClass {
|
||||
|
||||
case JD:
|
||||
throw new RuntimeException();
|
||||
default:
|
||||
}
|
||||
case IF:
|
||||
switch (clz) {
|
||||
@ -141,6 +143,7 @@ public enum TypeClass {
|
||||
|
||||
case JD:
|
||||
throw new RuntimeException();
|
||||
default:
|
||||
}
|
||||
case ZIF:
|
||||
switch (clz) {
|
||||
@ -154,6 +157,7 @@ public enum TypeClass {
|
||||
|
||||
case JD:
|
||||
throw new RuntimeException();
|
||||
default:
|
||||
}
|
||||
case ZI:
|
||||
switch (clz) {
|
||||
@ -165,9 +169,11 @@ public enum TypeClass {
|
||||
return thizCls;
|
||||
case JD:
|
||||
throw new RuntimeException();
|
||||
default:
|
||||
}
|
||||
case JD:
|
||||
throw new RuntimeException();
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class AggTransformer extends StatedTransformer {
|
||||
case NOP:
|
||||
case RETURN_VOID:
|
||||
continue;
|
||||
default:
|
||||
}
|
||||
try {
|
||||
localCanExecFirst(local, next);
|
||||
@ -100,6 +101,7 @@ public class AggTransformer extends StatedTransformer {
|
||||
localCanExecFirst(local, op1.getOp2());
|
||||
localCanExecFirst(local, op2);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -300,6 +302,7 @@ public class AggTransformer extends StatedTransformer {
|
||||
case FCMPL:
|
||||
case NOT:
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1,22 +1,13 @@
|
||||
package com.googlecode.dex2jar.ir.ts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.googlecode.dex2jar.ir.IrMethod;
|
||||
import com.googlecode.dex2jar.ir.LabelAndLocalMapper;
|
||||
import com.googlecode.dex2jar.ir.Trap;
|
||||
import com.googlecode.dex2jar.ir.expr.Local;
|
||||
import com.googlecode.dex2jar.ir.expr.Value.VT;
|
||||
import com.googlecode.dex2jar.ir.stmt.GotoStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.IfStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt.E2Stmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.*;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt.ST;
|
||||
import com.googlecode.dex2jar.ir.stmt.StmtList;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Try to clean following between a {@link Trap}
|
||||
|
@ -20,7 +20,6 @@ import com.googlecode.dex2jar.ir.Trap;
|
||||
import com.googlecode.dex2jar.ir.expr.Exprs;
|
||||
import com.googlecode.dex2jar.ir.expr.Local;
|
||||
import com.googlecode.dex2jar.ir.expr.Value.VT;
|
||||
import com.googlecode.dex2jar.ir.stmt.AssignStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.GotoStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt;
|
||||
|
@ -16,11 +16,6 @@
|
||||
*/
|
||||
package com.googlecode.dex2jar.ir.ts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.googlecode.dex2jar.ir.IrMethod;
|
||||
import com.googlecode.dex2jar.ir.LabelAndLocalMapper;
|
||||
import com.googlecode.dex2jar.ir.Trap;
|
||||
@ -29,6 +24,9 @@ import com.googlecode.dex2jar.ir.stmt.Stmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt.ST;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Trim Exception handler.
|
||||
*
|
||||
@ -74,7 +72,7 @@ import com.googlecode.dex2jar.ir.stmt.Stmts;
|
||||
*/
|
||||
public class ExceptionHandlerTrim implements Transformer {
|
||||
|
||||
@SuppressWarnings({ "serial", "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void transform(IrMethod irMethod) {
|
||||
List<Trap> trips = irMethod.traps;
|
||||
|
@ -90,6 +90,7 @@ public class JimpleTransformer implements Transformer {
|
||||
case NEW:
|
||||
case STATIC_FIELD:
|
||||
return tmp.newAssign(x);
|
||||
default:
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -16,9 +16,6 @@
|
||||
*/
|
||||
package com.googlecode.dex2jar.ir.ts;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.googlecode.dex2jar.ir.IrMethod;
|
||||
import com.googlecode.dex2jar.ir.StmtTraveler;
|
||||
import com.googlecode.dex2jar.ir.expr.Constant;
|
||||
@ -44,7 +41,6 @@ public class NpeTransformer extends StatedTransformer {
|
||||
if (method.locals.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
Set<Stmt> npes = new HashSet<>();
|
||||
StmtTraveler st = new StmtTraveler() {
|
||||
@Override
|
||||
public Stmt travel(Stmt stmt) {
|
||||
@ -79,7 +75,7 @@ public class NpeTransformer extends StatedTransformer {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
return op;
|
||||
}
|
||||
@ -131,7 +127,7 @@ public class NpeTransformer extends StatedTransformer {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
Value sop = super.travel(op);
|
||||
if (sop.vt == Value.VT.LOCAL || sop.vt == Value.VT.CONSTANT) {
|
||||
@ -179,6 +175,7 @@ public class NpeTransformer extends StatedTransformer {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case En:
|
||||
}
|
||||
} catch (XNPE e) {
|
||||
m.stmts.insertBefore(p,
|
||||
|
@ -164,6 +164,7 @@ public class TypeTransformer implements Transformer {
|
||||
case INT:
|
||||
case IF:
|
||||
return "I";
|
||||
default:
|
||||
}
|
||||
throw new RuntimeException();
|
||||
}
|
||||
@ -278,6 +279,8 @@ public class TypeTransformer implements Transformer {
|
||||
case DOUBLE:
|
||||
case VOID:
|
||||
ref.provideDesc = clz.name;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
String provideDesc = ref.provideDesc;
|
||||
if (provideDesc == null && ref.parents != null && ref.parents.size() > 1) {
|
||||
@ -469,6 +472,7 @@ public class TypeTransformer implements Transformer {
|
||||
provideAs(cst, "L");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@ -528,6 +532,7 @@ public class TypeTransformer implements Transformer {
|
||||
useAs(v, ue.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
if (v != null) {
|
||||
exExpr(v);
|
||||
@ -686,6 +691,7 @@ public class TypeTransformer implements Transformer {
|
||||
linkFromTo(vb, enExpr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
for (Value vb : enExpr.ops) {
|
||||
exExpr(vb);
|
||||
@ -798,6 +804,7 @@ public class TypeTransformer implements Transformer {
|
||||
case RETURN:
|
||||
useAs(op, method.ret);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
exExpr(op);
|
||||
}
|
||||
|
@ -1,18 +1,14 @@
|
||||
package com.googlecode.dex2jar.ir.test;
|
||||
|
||||
import static com.googlecode.dex2jar.ir.expr.Exprs.*;
|
||||
import static com.googlecode.dex2jar.ir.stmt.Stmts.*;
|
||||
|
||||
import com.googlecode.dex2jar.ir.expr.Value;
|
||||
import com.googlecode.dex2jar.ir.expr.Local;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt;
|
||||
import com.googlecode.dex2jar.ir.ts.RemoveLocalFromSSA;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.googlecode.dex2jar.ir.expr.Exprs;
|
||||
import com.googlecode.dex2jar.ir.expr.Local;
|
||||
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt;
|
||||
import com.googlecode.dex2jar.ir.ts.RemoveConstantFromSSA;
|
||||
import static com.googlecode.dex2jar.ir.expr.Exprs.nInt;
|
||||
import static com.googlecode.dex2jar.ir.stmt.Stmts.nAssign;
|
||||
import static com.googlecode.dex2jar.ir.stmt.Stmts.nReturn;
|
||||
|
||||
public class RemoveLocalFromSSATest extends BaseTransformerTest<RemoveLocalFromSSA> {
|
||||
@Test
|
||||
|
@ -27,7 +27,6 @@ public class AutoDetectSourceProcess {
|
||||
|
||||
public final void process(String file) throws IOException {
|
||||
Path path = new File(file).toPath();
|
||||
final int basePathLength = path.getNameCount();
|
||||
if (Files.isDirectory(path)) {
|
||||
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
|
||||
|
||||
|
@ -75,7 +75,6 @@ public class ProguardMappingParser {
|
||||
String fieldNameOrMethodNameDesc = as[1];
|
||||
String newName = as[3];
|
||||
|
||||
String key;
|
||||
if (fieldNameOrMethodNameDesc.contains("(")) { // a method
|
||||
|
||||
int idx = fieldNameOrMethodNameDesc.indexOf('(');
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.googlecode.d2j.tools.jar;
|
||||
|
||||
import com.googlecode.d2j.reader.zip.ZipUtil;
|
||||
import com.googlecode.dex2jar.tools.BaseCmd;
|
||||
import org.objectweb.asm.*;
|
||||
import org.objectweb.asm.commons.Remapper;
|
||||
@ -92,7 +91,7 @@ public class InvocationWeaver implements Opcodes {
|
||||
private static final String DEFAULT_RET_TYPE = "Ld/$$$/j;";
|
||||
private static final String DEFAULT_DESC = "(L;)" + DEFAULT_RET_TYPE;
|
||||
private static final Type OBJECT_TYPE = Type.getType(Object.class);
|
||||
private static String BASE_INVOCATION_TYPE_FMT = "d2j/gen/MI_%03d";
|
||||
private static final String BASE_INVOCATION_TYPE_FMT = "d2j/gen/MI_%03d";
|
||||
List<Callback> callbacks = new ArrayList<Callback>();
|
||||
int currentInvocationIdx = 0;
|
||||
private MtdInfo key = new MtdInfo();
|
||||
@ -272,13 +271,12 @@ public class InvocationWeaver implements Opcodes {
|
||||
n.owner = t.owner;
|
||||
n.name = t.name + "$$$_A_";
|
||||
|
||||
int acc = 0;
|
||||
String nDesc = t.desc;
|
||||
boolean hasThis = opcode != INVOKESTATIC;
|
||||
Type[] args = Type.getArgumentTypes(t.desc);
|
||||
Type ret = Type.getReturnType(t.desc);
|
||||
if (hasThis) {
|
||||
List<Type> ts = new ArrayList(5);
|
||||
List<Type> ts = new ArrayList<>(5);
|
||||
ts.add(Type.getObjectType(t.owner));
|
||||
ts.addAll(Arrays.asList(args));
|
||||
nDesc = Type.getMethodDescriptor(ret, ts.toArray(new Type[ts.size()]));
|
||||
|
@ -34,7 +34,7 @@ import com.googlecode.d2j.signapk.TinySignImpl;
|
||||
|
||||
@BaseCmd.Syntax(cmd = "d2j-apk-sign", syntax = "[options] <apk>", desc = "Sign an android apk file use a test certificate.")
|
||||
public class ApkSign extends BaseCmd {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new ApkSign().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class AsmVerify extends BaseCmd {
|
||||
return n == -1 ? name : "o";
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new AsmVerify().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class DeObfInitCmd extends BaseCmd {
|
||||
super("d2j-init-deobf [options] <jar>", "generate an init config file for deObfuscate a jar");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new DeObfInitCmd().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ import com.googlecode.dex2jar.tools.BaseCmd.Syntax;
|
||||
|
||||
@Syntax(cmd = "d2j-decrypt-string", syntax = "[options] <jar>", desc = "Decrypt in class file", onlineHelp = "https://code.google.com/p/dex2jar/wiki/DecryptStrings")
|
||||
public class DecryptStringCmd extends BaseCmd {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new DecryptStringCmd().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import com.googlecode.dex2jar.ir.ET;
|
||||
@BaseCmd.Syntax(cmd = "d2j-dex2jar", syntax = "[options] <file0> [file1 ... fileN]", desc = "convert dex to jar")
|
||||
public class Dex2jarCmd extends BaseCmd {
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new Dex2jarCmd().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -19,20 +19,14 @@ package com.googlecode.dex2jar.tools;
|
||||
import com.googlecode.d2j.dex.writer.DexFileWriter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@BaseCmd.Syntax(cmd = "d2j-dex-recompute-checksum", syntax = "[options] dex", desc = "recompute crc and sha1 of dex.")
|
||||
public class DexRecomputeChecksum extends BaseCmd {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new DexRecomputeChecksum().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,8 @@ public class DexWeaverCmd extends BaseCmd {
|
||||
case INVOKE_VIRTUAL_RANGE:
|
||||
super.visitMethodStmt(Op.INVOKE_STATIC_RANGE, args, replaceTo);
|
||||
break;
|
||||
default:
|
||||
// impossible here
|
||||
}
|
||||
} else {
|
||||
super.visitMethodStmt(op, args, method);
|
||||
|
@ -19,7 +19,7 @@ public class GenerateCompileStubFromOdex extends BaseCmd {
|
||||
private static final int MAGIC_ODEX = 0x0A796564 & 0x00FFFFFF;// hex for 'dey ', ignore the 0A
|
||||
private static final int MAGIC_DEX = 0x0A786564 & 0x00FFFFFF;// hex for 'dex ', ignore the 0A
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new GenerateCompileStubFromOdex().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
||||
|
||||
@BaseCmd.Syntax(cmd = "d2j-jar2dex", syntax = "[options] <dir>", desc = "Convert jar to dex by invoking dx.")
|
||||
public class Jar2Dex extends BaseCmd {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new Jar2Dex().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import org.objectweb.asm.*;
|
||||
|
||||
@BaseCmd.Syntax(cmd = "d2j-jar-access", syntax = "[options] <jar>", desc = "add or remove class/method/field access in jar file")
|
||||
public class JarAccessCmd extends BaseCmd implements Opcodes {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new JarAccessCmd().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import com.googlecode.dex2jar.tools.BaseCmd.Syntax;
|
||||
|
||||
@Syntax(cmd = "d2j-jar-remap", syntax = "[options] jar", desc = "rename package/class/method/field name in a jar", onlineHelp = "https://code.google.com/p/dex2jar/wiki/DeObfuscateJarWithDexTool")
|
||||
public class JarRemap extends BaseCmd {
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new JarRemap().doMain(args);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class StdApkCmd extends BaseCmd {
|
||||
@Opt(opt = "o", longOpt = "output", description = "The output file", argName = "out", required = true)
|
||||
private Path output;
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String... args) {
|
||||
new StdApkCmd().doMain(args);
|
||||
}
|
||||
|
||||
@ -48,26 +48,27 @@ public class StdApkCmd extends BaseCmd {
|
||||
byte[] buffer = new byte[1000];
|
||||
try (ZipOutputStream zos = new AutoSTOREDZipOutputStream(Files.newOutputStream(output))) {
|
||||
byte[] data = Files.readAllBytes(new File(remainingArgs[0]).toPath());
|
||||
com.googlecode.d2j.util.zip.ZipFile zipFile = new com.googlecode.d2j.util.zip.ZipFile(data);
|
||||
for (com.googlecode.d2j.util.zip.ZipEntry e : zipFile.entries()) {
|
||||
ZipEntry nEntry = new ZipEntry(e.getName());
|
||||
try(com.googlecode.d2j.util.zip.ZipFile zipFile = new com.googlecode.d2j.util.zip.ZipFile(data)) {
|
||||
for (com.googlecode.d2j.util.zip.ZipEntry e : zipFile.entries()) {
|
||||
ZipEntry nEntry = new ZipEntry(e.getName());
|
||||
|
||||
nEntry.setMethod(e.getMethod() == com.googlecode.d2j.util.zip.ZipEntry.STORED ? ZipEntry.STORED
|
||||
: ZipEntry.DEFLATED);
|
||||
zos.putNextEntry(nEntry);
|
||||
nEntry.setMethod(e.getMethod() == com.googlecode.d2j.util.zip.ZipEntry.STORED ? ZipEntry.STORED
|
||||
: ZipEntry.DEFLATED);
|
||||
zos.putNextEntry(nEntry);
|
||||
|
||||
if (!nEntry.isDirectory()) {
|
||||
try (InputStream is = zipFile.getInputStream(e)) {
|
||||
while (true) {
|
||||
int c = is.read(buffer);
|
||||
if (c < 0) {
|
||||
break;
|
||||
if (!nEntry.isDirectory()) {
|
||||
try (InputStream is = zipFile.getInputStream(e)) {
|
||||
while (true) {
|
||||
int c = is.read(buffer);
|
||||
if (c < 0) {
|
||||
break;
|
||||
}
|
||||
zos.write(buffer, 0, c);
|
||||
}
|
||||
zos.write(buffer, 0, c);
|
||||
}
|
||||
}
|
||||
zos.closeEntry();
|
||||
}
|
||||
zos.closeEntry();
|
||||
}
|
||||
zos.finish();
|
||||
}
|
||||
|
@ -61,21 +61,21 @@ public class WaveTest {
|
||||
FileSystem fs = BaseCmd.openZip(new File(WaveTest.class.getResource("/wave.jar").getPath()).toPath())) {
|
||||
w.wave(fs.getPath("/"), fs2.getPath("/"));
|
||||
}
|
||||
URLClassLoader cl = new URLClassLoader(new URL[] { tmp.toURI().toURL() }, WaveTest.class.getClassLoader());
|
||||
Class<?> clz = cl.loadClass("com.googlecode.d2j.tools.jar.test.res.Res");
|
||||
List<Object> list = (List<Object>) clz.newInstance();
|
||||
Assert.assertFalse(list.add(""));
|
||||
Assert.assertEquals(-1, list.size());
|
||||
try(URLClassLoader cl = new URLClassLoader(new URL[] { tmp.toURI().toURL() }, WaveTest.class.getClassLoader())) {
|
||||
Class<?> clz = cl.loadClass("com.googlecode.d2j.tools.jar.test.res.Res");
|
||||
List<Object> list = (List<Object>) clz.newInstance();
|
||||
Assert.assertFalse(list.add(""));
|
||||
Assert.assertEquals(-1, list.size());
|
||||
|
||||
Method m = clz.getMethod("main", String[].class);
|
||||
System.out.println(m);
|
||||
m.invoke(null, new Object[] { null });
|
||||
Assert.assertTrue(appendCalled);
|
||||
Assert.assertTrue(printlnCalled);
|
||||
Method m = clz.getMethod("main", String[].class);
|
||||
System.out.println(m);
|
||||
m.invoke(null, new Object[]{null});
|
||||
Assert.assertTrue(appendCalled);
|
||||
Assert.assertTrue(printlnCalled);
|
||||
|
||||
list = null;
|
||||
cl.close();
|
||||
tmp.delete();
|
||||
list = null;
|
||||
tmp.delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,18 +16,13 @@
|
||||
*/
|
||||
package com.googlecode.d2j.dex;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.googlecode.d2j.Method;
|
||||
import com.googlecode.d2j.node.DexMethodNode;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.googlecode.d2j.Method;
|
||||
import com.googlecode.d2j.node.DexMethodNode;
|
||||
import com.googlecode.d2j.reader.DexFileReader;
|
||||
import com.googlecode.dex2jar.ir.ET;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
public class BaseDexExceptionHandler implements DexExceptionHandler {
|
||||
@Override
|
||||
|
@ -78,7 +78,6 @@ import com.googlecode.dex2jar.ir.stmt.LabelStmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmt;
|
||||
import com.googlecode.dex2jar.ir.stmt.StmtList;
|
||||
import com.googlecode.dex2jar.ir.stmt.Stmts;
|
||||
import org.objectweb.asm.tree.LabelNode;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:pxb1988@gmail.com">Panxiaobo</a>
|
||||
|
@ -16,12 +16,9 @@
|
||||
*/
|
||||
package com.googlecode.d2j.dex;
|
||||
|
||||
import com.googlecode.d2j.Method;
|
||||
import com.googlecode.d2j.node.DexMethodNode;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import com.googlecode.d2j.Method;
|
||||
import com.googlecode.dex2jar.ir.IrMethod;
|
||||
|
||||
public interface DexExceptionHandler {
|
||||
public void handleFileException(Exception e);
|
||||
|
@ -21,6 +21,7 @@ public class JumpOp extends OpInsn {
|
||||
CodeWriter.checkRegA(op, "vA", a);
|
||||
CodeWriter.checkRegA(op, "vB", b);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
this.label = label;
|
||||
this.a = a;
|
||||
@ -54,6 +55,8 @@ public class JumpOp extends OpInsn {
|
||||
CodeWriter.checkContentShort(op, "+BBBB", offset);
|
||||
out.put((byte) a).putShort((short) offset);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("not support");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user