mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-12 05:47:46 +01:00
dexlib2: ported "dontLoadClassPath feature"
This commit is contained in:
parent
2ca53880b1
commit
7904ec2a7c
@ -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);
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user