Fix generic types for abstract methods
This commit is contained in:
@@ -70,31 +70,22 @@ public class MethodNode extends AttrNode implements ILoadable {
|
||||
this.parentClass = classNode;
|
||||
this.accFlags = new AccessInfo(mth.getAccessFlags(), AFType.METHOD);
|
||||
this.methodData = mth;
|
||||
|
||||
if (methodData.getCodeOffset() == 0) {
|
||||
noCode = true;
|
||||
regsCount = 0;
|
||||
retType = mthInfo.getReturnType();
|
||||
initArguments(mthInfo.getArgumentsTypes());
|
||||
} else {
|
||||
noCode = false;
|
||||
}
|
||||
this.noCode = (methodData.getCodeOffset() == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() throws DecodeException {
|
||||
if (noCode)
|
||||
return;
|
||||
|
||||
try {
|
||||
if (noCode) {
|
||||
regsCount = 0;
|
||||
initMethodTypes();
|
||||
return;
|
||||
}
|
||||
|
||||
DexNode dex = parentClass.dex();
|
||||
Code mthCode = dex.readCode(methodData);
|
||||
regsCount = mthCode.getRegistersSize();
|
||||
|
||||
if (!parseSignature()) {
|
||||
retType = mthInfo.getReturnType();
|
||||
initArguments(mthInfo.getArgumentsTypes());
|
||||
}
|
||||
initMethodTypes();
|
||||
|
||||
InsnDecoder decoder = new InsnDecoder(this, mthCode);
|
||||
InsnNode[] insnByOffset = decoder.run();
|
||||
@@ -117,6 +108,13 @@ public class MethodNode extends AttrNode implements ILoadable {
|
||||
}
|
||||
}
|
||||
|
||||
private void initMethodTypes() {
|
||||
if (!parseSignature()) {
|
||||
retType = mthInfo.getReturnType();
|
||||
initArguments(mthInfo.getArgumentsTypes());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
if (noCode)
|
||||
@@ -185,12 +183,12 @@ public class MethodNode extends AttrNode implements ILoadable {
|
||||
|
||||
private void initArguments(List<ArgType> args) {
|
||||
int pos;
|
||||
if (!noCode) {
|
||||
if (noCode) {
|
||||
pos = 1;
|
||||
} else {
|
||||
pos = regsCount;
|
||||
for (ArgType arg : args)
|
||||
pos -= arg.getRegCount();
|
||||
} else {
|
||||
pos = 2 * args.size() + 1;
|
||||
}
|
||||
|
||||
if (accFlags.isStatic()) {
|
||||
|
||||
@@ -11,7 +11,11 @@ public class TestGenerics extends AbstractTest {
|
||||
|
||||
public Class<?>[] classes;
|
||||
|
||||
public static class GenericClass implements Comparable<String> {
|
||||
public interface MyComparable<T> {
|
||||
public int compareTo(T o);
|
||||
}
|
||||
|
||||
public static class GenericClass implements MyComparable<String> {
|
||||
@Override
|
||||
public int compareTo(String o) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user