dexlib2: ported "dontLoadClassPath feature"

This commit is contained in:
Connor Tumbleson 2013-06-20 08:46:08 -05:00
parent 2ca53880b1
commit 7904ec2a7c
2 changed files with 8 additions and 2 deletions

View File

@ -55,6 +55,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ClassPath {
public static boolean dontLoadClassPath = false;
@Nonnull private final TypeProto unknownClass;
@Nonnull private HashMap<String, ClassDef> availableClasses = Maps.newHashMap();
private int api;
@ -136,6 +138,10 @@ public class ClassPath {
@Nonnull
public ClassDef getClassDef(String type) {
if (dontLoadClassPath) {
return null;
}
ClassDef ret = availableClasses.get(type);
if (ret == null) {
throw new UnresolvedClassException("Could not resolve class %s", type);

View File

@ -1162,7 +1162,7 @@ public class MethodAnalyzer {
ThreeRegisterInstruction instruction = (ThreeRegisterInstruction)analyzedInstruction.instruction;
RegisterType arrayRegisterType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterB());
if (arrayRegisterType.category != RegisterType.NULL) {
if (! ClassPath.dontLoadClassPath && arrayRegisterType.category != RegisterType.NULL) {
if (arrayRegisterType.category != RegisterType.REFERENCE ||
!(arrayRegisterType.type instanceof ArrayProto)) {
throw new AnalysisException("aget-wide used with non-array register: %s", arrayRegisterType.toString());
@ -1193,7 +1193,7 @@ public class MethodAnalyzer {
ThreeRegisterInstruction instruction = (ThreeRegisterInstruction)analyzedInstruction.instruction;
RegisterType arrayRegisterType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterB());
if (arrayRegisterType.category != RegisterType.NULL) {
if (! ClassPath.dontLoadClassPath && arrayRegisterType.category != RegisterType.NULL) {
if (arrayRegisterType.category != RegisterType.REFERENCE ||
!(arrayRegisterType.type instanceof ArrayProto)) {
throw new AnalysisException("aget-object used with non-array register: %s",