mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
Merge pull request #229 from JMapfel/development
[BUGFIX] A bug where the method node lookup didn't work
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.parabot.core.asm.wrappers;
|
package org.parabot.core.asm.wrappers;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Type;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
import org.parabot.core.asm.ASMUtils;
|
import org.parabot.core.asm.ASMUtils;
|
||||||
@@ -35,7 +36,7 @@ public class Invoker implements Injectable {
|
|||||||
String argsDesc, String returnDesc, String methodName, boolean isInterface, String instanceCast, String argsCheckCastDesc) {
|
String argsDesc, String returnDesc, String methodName, boolean isInterface, String instanceCast, String argsCheckCastDesc) {
|
||||||
this.into = ASMUtils.getClass(into);
|
this.into = ASMUtils.getClass(into);
|
||||||
this.methodLocation = ASMUtils.getClass(methodLoc);
|
this.methodLocation = ASMUtils.getClass(methodLoc);
|
||||||
this.mn = getMethod(this.methodLocation, invMethName, argsDesc);
|
this.mn = getMethod(this.methodLocation, invMethName, argsDesc, returnDesc);
|
||||||
this.returnDesc = returnDesc;
|
this.returnDesc = returnDesc;
|
||||||
this.methodName = methodName;
|
this.methodName = methodName;
|
||||||
this.argsDesc = argsDesc;
|
this.argsDesc = argsDesc;
|
||||||
@@ -47,15 +48,15 @@ public class Invoker implements Injectable {
|
|||||||
this.argsCheckCastDesc = argsCheckCastDesc;
|
this.argsCheckCastDesc = argsCheckCastDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MethodNode getMethod(ClassNode into, String name, String desc) {
|
private static MethodNode getMethod(ClassNode into, String name, String argsDesc, String returnDesc) {
|
||||||
for (Object m : into.methods) {
|
for (Object method : into.methods) {
|
||||||
MethodNode methodNode = (MethodNode) m;
|
MethodNode m = (MethodNode) method;
|
||||||
String s = methodNode.desc.substring(0, methodNode.desc.indexOf(')') + 1);
|
if (m.name.equals(name) && m.desc.substring(0, m.desc.indexOf(')') + 1).equals(argsDesc)
|
||||||
if (methodNode.name.equals(name) && s.equals(desc)) {
|
&& (returnDesc == null || Type.getType(m.desc).getReturnType().getDescriptor().equals(returnDesc))) {
|
||||||
return methodNode;
|
return m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user