mirror of
https://github.com/revanced/smali.git
synced 2025-05-03 08:04:28 +02:00
Fix superclass and interfaces in DexBackedClassDef
This commit is contained in:
parent
4e3124206a
commit
2e34c4499c
@ -68,7 +68,7 @@ public class DexBackedClassDef implements ClassDef {
|
||||
|
||||
this.name = dexBuf.getType(dexBuf.readSmallUint(classDefOffset));
|
||||
this.accessFlags = dexBuf.readSmallUint(classDefOffset + ACCESS_FLAGS_OFFSET);
|
||||
this.superclass = dexBuf.getOptionalString(dexBuf.readOptionalUint(classDefOffset + SUPERCLASS_OFFSET));
|
||||
this.superclass = dexBuf.getOptionalType(dexBuf.readOptionalUint(classDefOffset + SUPERCLASS_OFFSET));
|
||||
this.interfacesOffset = dexBuf.readSmallUint(classDefOffset + INTERFACES_OFFSET);
|
||||
this.sourceFile = dexBuf.getOptionalString(dexBuf.readOptionalUint(classDefOffset + SOURCE_FILE_OFFSET));
|
||||
|
||||
@ -94,7 +94,7 @@ public class DexBackedClassDef implements ClassDef {
|
||||
@Nonnull
|
||||
@Override
|
||||
public String readItem(int index) {
|
||||
return dexBuf.getString(dexBuf.readSmallUint(interfacesOffset + 4 + (2*index)));
|
||||
return dexBuf.getType(dexBuf.readSmallUint(interfacesOffset + 4 + (2*index)));
|
||||
}
|
||||
|
||||
@Override public int size() { return size; }
|
||||
|
@ -219,6 +219,14 @@ public class DexBuffer {
|
||||
return Utf8Utils.utf8BytesToString(buf, reader.getOffset(), utf16Length);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getOptionalType(int typeIndex) {
|
||||
if (typeIndex == -1) {
|
||||
return null;
|
||||
}
|
||||
return getType(typeIndex);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getOptionalString(int stringIndex) {
|
||||
if (stringIndex == -1) {
|
||||
|
@ -56,6 +56,7 @@ public class DexReader {
|
||||
public String getString(int stringIndex) { return dexBuf.getString(stringIndex); }
|
||||
public String getOptionalString(int stringIndex) { return dexBuf.getOptionalString(stringIndex); }
|
||||
public String getType(int typeIndex) { return dexBuf.getType(typeIndex); }
|
||||
public String getOptionalType(int typeIndex) { return dexBuf.getOptionalType(typeIndex); }
|
||||
public String getField(int fieldIndex) { return dexBuf.getField(fieldIndex); }
|
||||
public String getMethod(int methodIndex) { return dexBuf.getMethod(methodIndex); }
|
||||
public String getReference(int type, int index) { return dexBuf.getReference(type, index); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user