mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
[TASK] Updated ASM to 5.0.4
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.ow2.asm</groupId>
|
<groupId>org.ow2.asm</groupId>
|
||||||
<artifactId>asm</artifactId>
|
<artifactId>asm-all</artifactId>
|
||||||
<version>5.0.4</version>
|
<version>5.0.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -55,11 +55,6 @@
|
|||||||
<artifactId>json-simple</artifactId>
|
<artifactId>json-simple</artifactId>
|
||||||
<version>1.1.1</version>
|
<version>1.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.ow2.asm</groupId>
|
|
||||||
<artifactId>asm-commons</artifactId>
|
|
||||||
<version>5.0.4</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ import java.lang.reflect.Modifier;
|
|||||||
public class ASMUtils implements Opcodes {
|
public class ASMUtils implements Opcodes {
|
||||||
|
|
||||||
public static FieldNode getField(ClassNode node, String fieldName) {
|
public static FieldNode getField(ClassNode node, String fieldName) {
|
||||||
for (final FieldNode fieldNode : node.fields) {
|
for (final Object fieldNode : node.fields) {
|
||||||
if (fieldNode.name.equals(fieldName)) {
|
FieldNode fieldNodeObject = (FieldNode) fieldNode;
|
||||||
return fieldNode;
|
if (fieldNodeObject.name.equals(fieldName)) {
|
||||||
|
return fieldNodeObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -30,9 +31,10 @@ public class ASMUtils implements Opcodes {
|
|||||||
if(desc == null) {
|
if(desc == null) {
|
||||||
return getField(node, fieldName);
|
return getField(node, fieldName);
|
||||||
}
|
}
|
||||||
for (final FieldNode fieldNode : node.fields) {
|
for (final Object fieldNode : node.fields) {
|
||||||
if (fieldNode.name.equals(fieldName) && fieldNode.desc.equals(desc)) {
|
FieldNode fieldNodeObject = (FieldNode) fieldNode;
|
||||||
return fieldNode;
|
if (fieldNodeObject.name.equals(fieldName) && fieldNodeObject.desc.equals(desc)) {
|
||||||
|
return fieldNodeObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -55,9 +57,10 @@ public class ASMUtils implements Opcodes {
|
|||||||
|
|
||||||
public static MethodNode getMethod(final ClassNode location,
|
public static MethodNode getMethod(final ClassNode location,
|
||||||
final String methodName, final String methodDesc) {
|
final String methodName, final String methodDesc) {
|
||||||
for (MethodNode mn : location.methods) {
|
for (Object mn : location.methods) {
|
||||||
if (mn.name.equals(methodName) && mn.desc.equals(methodDesc)) {
|
MethodNode methodNode = (MethodNode) mn;
|
||||||
return mn;
|
if (methodNode.name.equals(methodName) && methodNode.desc.equals(methodDesc)) {
|
||||||
|
return methodNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class AddGetterAdapter implements Opcodes, Injectable {
|
|||||||
* - classnode to inject getter method in
|
* - classnode to inject getter method in
|
||||||
* @param fieldLocation
|
* @param fieldLocation
|
||||||
* - classnode where field is located
|
* - classnode where field is located
|
||||||
* @param fieldName
|
* @param fieldNode
|
||||||
* - field name to get
|
* - field name to get
|
||||||
* @param methodName
|
* @param methodName
|
||||||
* - method name of getter
|
* - method name of getter
|
||||||
@@ -102,9 +102,10 @@ public class AddGetterAdapter implements Opcodes, Injectable {
|
|||||||
.append("()");
|
.append("()");
|
||||||
throw new RuntimeException(sb.toString());
|
throw new RuntimeException(sb.toString());
|
||||||
}
|
}
|
||||||
for (final MethodNode methodNode : into.methods) {
|
for (final Object methodNode : into.methods) {
|
||||||
if (methodNode.name.equals(methodName)) {
|
MethodNode methodNodeObject = (MethodNode) methodNode;
|
||||||
final Type[] args = Type.getArgumentTypes(methodNode.desc);
|
if (methodNodeObject.name.equals(methodName)) {
|
||||||
|
final Type[] args = Type.getArgumentTypes(methodNodeObject.desc);
|
||||||
if (args != null && args.length != 0) {
|
if (args != null && args.length != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,10 @@ public class AddInterfaceAdapter implements Injectable {
|
|||||||
|
|
||||||
protected static void addInterface(ClassNode node, String i) {
|
protected static void addInterface(ClassNode node, String i) {
|
||||||
ASMUtils.makePublic(node);
|
ASMUtils.makePublic(node);
|
||||||
for(MethodNode mn : node.methods) {
|
for(Object mn : node.methods) {
|
||||||
if(mn.name.startsWith("<init")) {
|
MethodNode methodNode = (MethodNode) mn;
|
||||||
ASMUtils.makePublic(mn);
|
if(methodNode.name.startsWith("<init")) {
|
||||||
|
ASMUtils.makePublic(methodNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node.interfaces.add(i);
|
node.interfaces.add(i);
|
||||||
|
|||||||
@@ -50,10 +50,11 @@ public class Invoker implements Injectable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static MethodNode getMethod(ClassNode into, String name, String desc) {
|
private static MethodNode getMethod(ClassNode into, String name, String desc) {
|
||||||
for (MethodNode m : into.methods) {
|
for (Object m : into.methods) {
|
||||||
String s = m.desc.substring(0, m.desc.indexOf(')') + 1);
|
MethodNode methodNode = (MethodNode) m;
|
||||||
if (m.name.equals(name) && s.equals(desc)) {
|
String s = methodNode.desc.substring(0, methodNode.desc.indexOf(')') + 1);
|
||||||
return m;
|
if (methodNode.name.equals(name) && s.equals(desc)) {
|
||||||
|
return methodNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user