Added dontLoadClassPath feature to smali.

This commit is contained in:
Ryszard Wiśniewski 2013-05-02 01:27:14 +02:00
parent 12c958c355
commit 62ac6fa870
2 changed files with 8 additions and 2 deletions

View File

@ -44,6 +44,8 @@ import static org.jf.dexlib.ClassDataItem.EncodedField;
import static org.jf.dexlib.ClassDataItem.EncodedMethod;
public class ClassPath {
public static boolean dontLoadClassPath = false;
private static ClassPath theClassPath = null;
/**
@ -261,6 +263,10 @@ public class ClassPath {
@Nonnull
public static ClassDef getClassDef(String classType, boolean createUnresolvedClassDef) {
if (dontLoadClassPath) {
return null;
}
ClassDef classDef = theClassPath.classDefs.get(classType);
if (classDef == null) {
//if it's an array class, try to create it

View File

@ -2434,7 +2434,7 @@ public class MethodAnalyzer {
RegisterType arrayRegisterType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterB());
assert arrayRegisterType != null;
if (arrayRegisterType.category != RegisterType.Category.Null) {
if (! ClassPath.dontLoadClassPath && arrayRegisterType.category != RegisterType.Category.Null) {
assert arrayRegisterType.type != null;
if (arrayRegisterType.type.getClassType().charAt(0) != '[') {
throw new ValidationException(String.format("Cannot use aget-wide with non-array type %s",
@ -2503,7 +2503,7 @@ public class MethodAnalyzer {
RegisterType arrayRegisterType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterB());
assert arrayRegisterType != null;
if (arrayRegisterType.category != RegisterType.Category.Null) {
if (! ClassPath.dontLoadClassPath && arrayRegisterType.category != RegisterType.Category.Null) {
assert arrayRegisterType.type != null;
if (arrayRegisterType.type.getClassType().charAt(0) != '[') {
throw new ValidationException(String.format("Cannot use aget-object with non-array type %s",