提交 81ee9e6b 编写于 作者: S Skylot

Remove unused code

上级 d5737ade
...@@ -177,7 +177,7 @@ public class ClassGen { ...@@ -177,7 +177,7 @@ public class ClassGen {
clsCode.startLine('}'); clsCode.startLine('}');
} }
private CodeWriter makeInnerClasses(ClassNode cls2, int indent) throws CodegenException { private CodeWriter makeInnerClasses(ClassNode cls, int indent) throws CodegenException {
CodeWriter innerClsCode = new CodeWriter(indent + 1); CodeWriter innerClsCode = new CodeWriter(indent + 1);
for (ClassNode inCls : cls.getInnerClasses()) { for (ClassNode inCls : cls.getInnerClasses()) {
if (inCls.isAnonymous()) if (inCls.isAnonymous())
......
...@@ -72,7 +72,7 @@ public class RegionGen extends InsnGen { ...@@ -72,7 +72,7 @@ public class RegionGen extends InsnGen {
} }
} }
private void declareVars(CodeWriter code, IContainer cont) throws CodegenException { private void declareVars(CodeWriter code, IContainer cont) {
DeclareVariableAttr declVars = DeclareVariableAttr declVars =
(DeclareVariableAttr) cont.getAttributes().get(AttributeType.DECLARE_VARIABLE); (DeclareVariableAttr) cont.getAttributes().get(AttributeType.DECLARE_VARIABLE);
if (declVars != null) { if (declVars != null) {
......
...@@ -22,21 +22,6 @@ public class TypeGen { ...@@ -22,21 +22,6 @@ public class TypeGen {
return stype.getLongName(); return stype.getLongName();
} }
@Deprecated
public static String shortString(ArgType type) {
final PrimitiveType stype = type.getPrimitiveType();
if (stype == null)
return type.toString();
if (stype == PrimitiveType.OBJECT) {
return "L";
}
if (stype == PrimitiveType.ARRAY) {
return shortString(type.getArrayElement()) + "A";
}
return stype.getLongName();
}
public static String signature(ArgType type) { public static String signature(ArgType type) {
final PrimitiveType stype = type.getPrimitiveType(); final PrimitiveType stype = type.getPrimitiveType();
if (stype == PrimitiveType.OBJECT) { if (stype == PrimitiveType.OBJECT) {
......
...@@ -72,12 +72,8 @@ public final class ClassInfo { ...@@ -72,12 +72,8 @@ public final class ClassInfo {
int sep = name.lastIndexOf('$'); int sep = name.lastIndexOf('$');
if (sep > 0 && sep != name.length() - 1) { if (sep > 0 && sep != name.length() - 1) {
String parClsName = pkg + '.' + name.substring(0, sep); String parClsName = pkg + '.' + name.substring(0, sep);
if (notObfuscated || dex.root().isClassExists(parClsName)) { parentClass = fromName(dex, parClsName);
parentClass = fromName(dex, parClsName); name = name.substring(sep + 1);
name = name.substring(sep + 1);
} else {
parentClass = null;
}
} else { } else {
parentClass = null; parentClass = null;
} }
......
...@@ -22,7 +22,7 @@ public class LocalVarInfo extends RegisterArg { ...@@ -22,7 +22,7 @@ public class LocalVarInfo extends RegisterArg {
init(name, type, sign); init(name, type, sign);
} }
public LocalVarInfo(DexNode dex, RegisterArg arg) { public LocalVarInfo(RegisterArg arg) {
super(arg.getRegNum()); super(arg.getRegNum());
init(arg.getTypedVar().getName(), arg.getType(), null); init(arg.getTypedVar().getName(), arg.getType(), null);
} }
......
...@@ -13,7 +13,7 @@ public class IfNode extends GotoNode { ...@@ -13,7 +13,7 @@ public class IfNode extends GotoNode {
protected boolean zeroCmp; protected boolean zeroCmp;
protected IfOp op; protected IfOp op;
public IfNode(IfOp op, int targ, InsnArg then, InsnArg els) { public IfNode(int targ, InsnArg then, InsnArg els) {
super(InsnType.IF, targ); super(InsnType.IF, targ);
addArg(then); addArg(then);
if (els == null) { if (els == null) {
......
...@@ -11,7 +11,7 @@ import jadx.utils.Utils; ...@@ -11,7 +11,7 @@ import jadx.utils.Utils;
public class TernaryInsn extends IfNode { public class TernaryInsn extends IfNode {
public TernaryInsn(IfOp op, InsnNode then, InsnNode els) { public TernaryInsn(IfOp op, InsnNode then, InsnNode els) {
super(op, then.getOffset(), super(then.getOffset(),
InsnArg.wrap(then), InsnArg.wrap(then),
els == null ? null : InsnArg.wrap(els)); els == null ? null : InsnArg.wrap(els));
} }
......
...@@ -27,7 +27,7 @@ public class BlockNode extends AttrNode implements IBlock { ...@@ -27,7 +27,7 @@ public class BlockNode extends AttrNode implements IBlock {
private BlockRegState startState; private BlockRegState startState;
private BlockRegState endState; private BlockRegState endState;
public BlockNode(MethodNode mth, int id, int offset) { public BlockNode(int id, int offset) {
this.id = id; this.id = id;
this.startOffset = offset; this.startOffset = offset;
} }
......
...@@ -6,7 +6,6 @@ import jadx.dex.instructions.args.ArgType; ...@@ -6,7 +6,6 @@ import jadx.dex.instructions.args.ArgType;
import jadx.utils.exceptions.DecodeException; import jadx.utils.exceptions.DecodeException;
import jadx.utils.files.InputFile; import jadx.utils.files.InputFile;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -38,7 +37,7 @@ public class DexNode { ...@@ -38,7 +37,7 @@ public class DexNode {
this.strings = stringList.toArray(new String[stringList.size()]); this.strings = stringList.toArray(new String[stringList.size()]);
} }
public void loadClasses(RootNode root) throws DecodeException { public void loadClasses() throws DecodeException {
for (ClassDef cls : dexBuf.classDefs()) { for (ClassDef cls : dexBuf.classDefs()) {
classes.add(new ClassNode(this, cls)); classes.add(new ClassNode(this, cls));
} }
......
...@@ -40,7 +40,7 @@ public class RootNode { ...@@ -40,7 +40,7 @@ public class RootNode {
} }
for (DexNode dexNode : dexNodes) for (DexNode dexNode : dexNodes)
dexNode.loadClasses(this); dexNode.loadClasses();
for (DexNode dexNode : dexNodes) { for (DexNode dexNode : dexNodes) {
for (ClassNode cls : dexNode.getClasses()) for (ClassNode cls : dexNode.getClasses())
...@@ -76,14 +76,6 @@ public class RootNode { ...@@ -76,14 +76,6 @@ public class RootNode {
return names.get(fullName); return names.get(fullName);
} }
/**
* Without full classpath listing this function is useless
*/
@Deprecated
public boolean isClassExists(String fullName) {
return true;
}
public ClassNode resolveClass(ClassInfo cls) { public ClassNode resolveClass(ClassInfo cls) {
String fullName = cls.getFullName(); String fullName = cls.getFullName();
ClassNode rCls = searchClassByName(fullName); ClassNode rCls = searchClassByName(fullName);
......
...@@ -67,7 +67,7 @@ public class DebugInfoParser { ...@@ -67,7 +67,7 @@ public class DebugInfoParser {
for (RegisterArg arg : mthArgs) { for (RegisterArg arg : mthArgs) {
int rn = arg.getRegNum(); int rn = arg.getRegNum();
locals[rn] = new LocalVarInfo(dex, arg); locals[rn] = new LocalVarInfo(arg);
activeRegisters[rn] = arg; activeRegisters[rn] = arg;
} }
......
...@@ -143,8 +143,8 @@ public class BlockMakerVisitor extends AbstractVisitor { ...@@ -143,8 +143,8 @@ public class BlockMakerVisitor extends AbstractVisitor {
List<IAttribute> jumps = insn.getAttributes().getAll(AttributeType.JUMP); List<IAttribute> jumps = insn.getAttributes().getAll(AttributeType.JUMP);
for (IAttribute attr : jumps) { for (IAttribute attr : jumps) {
JumpAttribute jump = (JumpAttribute) attr; JumpAttribute jump = (JumpAttribute) attr;
BlockNode srcBlock = getBlock(mth, jump.getSrc(), blocksMap); BlockNode srcBlock = getBlock(jump.getSrc(), blocksMap);
BlockNode thisblock = getBlock(mth, jump.getDest(), blocksMap); BlockNode thisblock = getBlock(jump.getDest(), blocksMap);
connect(srcBlock, thisblock); connect(srcBlock, thisblock);
} }
...@@ -156,7 +156,7 @@ public class BlockMakerVisitor extends AbstractVisitor { ...@@ -156,7 +156,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
if (spl != null) { if (spl != null) {
BlockNode connBlock = ((SplitterBlockAttr) spl).getBlock(); BlockNode connBlock = ((SplitterBlockAttr) spl).getBlock();
for (ExceptionHandler h : catches.getTryBlock().getHandlers()) { for (ExceptionHandler h : catches.getTryBlock().getHandlers()) {
BlockNode destBlock = getBlock(mth, h.getHandleOffset(), blocksMap); BlockNode destBlock = getBlock(h.getHandleOffset(), blocksMap);
// skip self loop in handler // skip self loop in handler
if (connBlock != destBlock) if (connBlock != destBlock)
// && !connBlock.getPredecessors().contains(destBlock)) // && !connBlock.getPredecessors().contains(destBlock))
...@@ -183,7 +183,7 @@ public class BlockMakerVisitor extends AbstractVisitor { ...@@ -183,7 +183,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
} }
} }
private static BlockNode getBlock(MethodNode mth, int offset, Map<Integer, BlockNode> blocksMap) { private static BlockNode getBlock(int offset, Map<Integer, BlockNode> blocksMap) {
BlockNode block = blocksMap.get(offset); BlockNode block = blocksMap.get(offset);
assert block != null; assert block != null;
return block; return block;
...@@ -202,7 +202,7 @@ public class BlockMakerVisitor extends AbstractVisitor { ...@@ -202,7 +202,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
} }
private static BlockNode startNewBlock(MethodNode mth, int offset) { private static BlockNode startNewBlock(MethodNode mth, int offset) {
BlockNode block = new BlockNode(mth, ++nextBlockId, offset); BlockNode block = new BlockNode(++nextBlockId, offset);
mth.getBasicBlocks().add(block); mth.getBasicBlocks().add(block);
return block; return block;
} }
......
...@@ -19,7 +19,7 @@ public class BlockProcessingHelper { ...@@ -19,7 +19,7 @@ public class BlockProcessingHelper {
return; return;
for (BlockNode block : mth.getBasicBlocks()) { for (BlockNode block : mth.getBasicBlocks()) {
markExceptionHandlers(mth, block); markExceptionHandlers(block);
} }
for (BlockNode block : mth.getBasicBlocks()) { for (BlockNode block : mth.getBasicBlocks()) {
block.updateCleanSuccessors(); block.updateCleanSuccessors();
...@@ -35,7 +35,7 @@ public class BlockProcessingHelper { ...@@ -35,7 +35,7 @@ public class BlockProcessingHelper {
/** /**
* Set exception handler attribute for whole block * Set exception handler attribute for whole block
*/ */
private static void markExceptionHandlers(MethodNode mth, BlockNode block) { private static void markExceptionHandlers(BlockNode block) {
if (!block.getInstructions().isEmpty()) { if (!block.getInstructions().isEmpty()) {
InsnNode me = block.getInstructions().get(0); InsnNode me = block.getInstructions().get(0);
ExcHandlerAttr handlerAttr = (ExcHandlerAttr) me.getAttributes().get(AttributeType.EXC_HANDLER); ExcHandlerAttr handlerAttr = (ExcHandlerAttr) me.getAttributes().get(AttributeType.EXC_HANDLER);
......
...@@ -105,7 +105,7 @@ public class ConstInlinerVisitor extends AbstractVisitor { ...@@ -105,7 +105,7 @@ public class ConstInlinerVisitor extends AbstractVisitor {
/** /**
* This is method similar to PostTypeResolver.visit method, * This is method similar to PostTypeResolver.visit method,
* but contains some expensive operations needed only after consts inlining * but contains some expensive operations needed only after constant inline
*/ */
private static void fixTypes(MethodNode mth, InsnNode insn) { private static void fixTypes(MethodNode mth, InsnNode insn) {
switch (insn.getType()) { switch (insn.getType()) {
......
...@@ -40,7 +40,7 @@ public class MethodInlinerVisitor extends AbstractVisitor { ...@@ -40,7 +40,7 @@ public class MethodInlinerVisitor extends AbstractVisitor {
if (block.getInstructions().size() == 1) { if (block.getInstructions().size() == 1) {
InsnNode insn = block.getInstructions().get(0); InsnNode insn = block.getInstructions().get(0);
addInlineAttr(mth, insn); addInlineAttr(mth, insn);
} }
} }
} }
} }
......
...@@ -52,8 +52,8 @@ public class BlockUtils { ...@@ -52,8 +52,8 @@ public class BlockUtils {
if (from.getCleanSuccessors().contains(to)) if (from.getCleanSuccessors().contains(to))
return false; // already checked return false; // already checked
return from.getSuccessors().contains(to); return from.getSuccessors().contains(to);
} }
/** /**
* Remove exception handlers from block nodes bitset * Remove exception handlers from block nodes bitset
...@@ -66,7 +66,7 @@ public class BlockUtils { ...@@ -66,7 +66,7 @@ public class BlockUtils {
} }
} }
public static BlockNode canMergeNextBlock(MethodNode mth, BlockNode block) { public static BlockNode canMergeNextBlock(BlockNode block) {
BlockNode next = getNextBlock(block); BlockNode next = getNextBlock(block);
if (next != null) { if (next != null) {
if (next.getIDom() == block) { if (next.getIDom() == block) {
......
...@@ -126,7 +126,7 @@ public class Utils { ...@@ -126,7 +126,7 @@ public class Utils {
public static String getJadxVersion() { public static String getJadxVersion() {
try { try {
Enumeration<URL> resources = Enumeration<URL> resources =
Utils.class.getClassLoader().getResources("META-INF/MANIFEST.MF"); Utils.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) { while (resources.hasMoreElements()) {
Manifest manifest = new Manifest(resources.nextElement().openStream()); Manifest manifest = new Manifest(resources.nextElement().openStream());
String ver = manifest.getMainAttributes().getValue("jadx-version"); String ver = manifest.getMainAttributes().getValue("jadx-version");
......
package jadx.utils.exceptions; package jadx.utils.exceptions;
public class JadxRuntimeException extends RuntimeException { public class JadxRuntimeException extends RuntimeException {
private static final long serialVersionUID = -7410848445429898248L; private static final long serialVersionUID = -7410848445429898248L;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册