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

Remove unused code

上级 d5737ade
......@@ -177,7 +177,7 @@ public class ClassGen {
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);
for (ClassNode inCls : cls.getInnerClasses()) {
if (inCls.isAnonymous())
......
......@@ -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) cont.getAttributes().get(AttributeType.DECLARE_VARIABLE);
if (declVars != null) {
......
......@@ -22,21 +22,6 @@ public class TypeGen {
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) {
final PrimitiveType stype = type.getPrimitiveType();
if (stype == PrimitiveType.OBJECT) {
......
......@@ -72,12 +72,8 @@ public final class ClassInfo {
int sep = name.lastIndexOf('$');
if (sep > 0 && sep != name.length() - 1) {
String parClsName = pkg + '.' + name.substring(0, sep);
if (notObfuscated || dex.root().isClassExists(parClsName)) {
parentClass = fromName(dex, parClsName);
name = name.substring(sep + 1);
} else {
parentClass = null;
}
parentClass = fromName(dex, parClsName);
name = name.substring(sep + 1);
} else {
parentClass = null;
}
......
......@@ -22,7 +22,7 @@ public class LocalVarInfo extends RegisterArg {
init(name, type, sign);
}
public LocalVarInfo(DexNode dex, RegisterArg arg) {
public LocalVarInfo(RegisterArg arg) {
super(arg.getRegNum());
init(arg.getTypedVar().getName(), arg.getType(), null);
}
......
......@@ -13,7 +13,7 @@ public class IfNode extends GotoNode {
protected boolean zeroCmp;
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);
addArg(then);
if (els == null) {
......
......@@ -11,7 +11,7 @@ import jadx.utils.Utils;
public class TernaryInsn extends IfNode {
public TernaryInsn(IfOp op, InsnNode then, InsnNode els) {
super(op, then.getOffset(),
super(then.getOffset(),
InsnArg.wrap(then),
els == null ? null : InsnArg.wrap(els));
}
......
......@@ -27,7 +27,7 @@ public class BlockNode extends AttrNode implements IBlock {
private BlockRegState startState;
private BlockRegState endState;
public BlockNode(MethodNode mth, int id, int offset) {
public BlockNode(int id, int offset) {
this.id = id;
this.startOffset = offset;
}
......
......@@ -6,7 +6,6 @@ import jadx.dex.instructions.args.ArgType;
import jadx.utils.exceptions.DecodeException;
import jadx.utils.files.InputFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
......@@ -38,7 +37,7 @@ public class DexNode {
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()) {
classes.add(new ClassNode(this, cls));
}
......
......@@ -40,7 +40,7 @@ public class RootNode {
}
for (DexNode dexNode : dexNodes)
dexNode.loadClasses(this);
dexNode.loadClasses();
for (DexNode dexNode : dexNodes) {
for (ClassNode cls : dexNode.getClasses())
......@@ -76,14 +76,6 @@ public class RootNode {
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) {
String fullName = cls.getFullName();
ClassNode rCls = searchClassByName(fullName);
......
......@@ -67,7 +67,7 @@ public class DebugInfoParser {
for (RegisterArg arg : mthArgs) {
int rn = arg.getRegNum();
locals[rn] = new LocalVarInfo(dex, arg);
locals[rn] = new LocalVarInfo(arg);
activeRegisters[rn] = arg;
}
......
......@@ -143,8 +143,8 @@ public class BlockMakerVisitor extends AbstractVisitor {
List<IAttribute> jumps = insn.getAttributes().getAll(AttributeType.JUMP);
for (IAttribute attr : jumps) {
JumpAttribute jump = (JumpAttribute) attr;
BlockNode srcBlock = getBlock(mth, jump.getSrc(), blocksMap);
BlockNode thisblock = getBlock(mth, jump.getDest(), blocksMap);
BlockNode srcBlock = getBlock(jump.getSrc(), blocksMap);
BlockNode thisblock = getBlock(jump.getDest(), blocksMap);
connect(srcBlock, thisblock);
}
......@@ -156,7 +156,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
if (spl != null) {
BlockNode connBlock = ((SplitterBlockAttr) spl).getBlock();
for (ExceptionHandler h : catches.getTryBlock().getHandlers()) {
BlockNode destBlock = getBlock(mth, h.getHandleOffset(), blocksMap);
BlockNode destBlock = getBlock(h.getHandleOffset(), blocksMap);
// skip self loop in handler
if (connBlock != destBlock)
// && !connBlock.getPredecessors().contains(destBlock))
......@@ -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);
assert block != null;
return block;
......@@ -202,7 +202,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
}
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);
return block;
}
......
......@@ -19,7 +19,7 @@ public class BlockProcessingHelper {
return;
for (BlockNode block : mth.getBasicBlocks()) {
markExceptionHandlers(mth, block);
markExceptionHandlers(block);
}
for (BlockNode block : mth.getBasicBlocks()) {
block.updateCleanSuccessors();
......@@ -35,7 +35,7 @@ public class BlockProcessingHelper {
/**
* 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()) {
InsnNode me = block.getInstructions().get(0);
ExcHandlerAttr handlerAttr = (ExcHandlerAttr) me.getAttributes().get(AttributeType.EXC_HANDLER);
......
......@@ -105,7 +105,7 @@ public class ConstInlinerVisitor extends AbstractVisitor {
/**
* 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) {
switch (insn.getType()) {
......
......@@ -40,7 +40,7 @@ public class MethodInlinerVisitor extends AbstractVisitor {
if (block.getInstructions().size() == 1) {
InsnNode insn = block.getInstructions().get(0);
addInlineAttr(mth, insn);
}
}
}
}
}
......
......@@ -52,8 +52,8 @@ public class BlockUtils {
if (from.getCleanSuccessors().contains(to))
return false; // already checked
return from.getSuccessors().contains(to);
}
return from.getSuccessors().contains(to);
}
/**
* Remove exception handlers from block nodes bitset
......@@ -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);
if (next != null) {
if (next.getIDom() == block) {
......
......@@ -126,7 +126,7 @@ public class Utils {
public static String getJadxVersion() {
try {
Enumeration<URL> resources =
Utils.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
Utils.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) {
Manifest manifest = new Manifest(resources.nextElement().openStream());
String ver = manifest.getMainAttributes().getValue("jadx-version");
......
package jadx.utils.exceptions;
public class JadxRuntimeException extends RuntimeException {
private static final long serialVersionUID = -7410848445429898248L;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册