[TASK] Updated ASM to 5.0.4

This commit is contained in:
JKetelaar
2015-12-26 18:46:06 +01:00
parent 4c495bdd4c
commit 4dcb5f988c
5 changed files with 27 additions and 26 deletions
+1 -6
View File
@@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<artifactId>asm-all</artifactId>
<version>5.0.4</version>
</dependency>
<dependency>
@@ -55,11 +55,6 @@
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>5.0.4</version>
</dependency>
</dependencies>
<build>
@@ -18,9 +18,10 @@ import java.lang.reflect.Modifier;
public class ASMUtils implements Opcodes {
public static FieldNode getField(ClassNode node, String fieldName) {
for (final FieldNode fieldNode : node.fields) {
if (fieldNode.name.equals(fieldName)) {
return fieldNode;
for (final Object fieldNode : node.fields) {
FieldNode fieldNodeObject = (FieldNode) fieldNode;
if (fieldNodeObject.name.equals(fieldName)) {
return fieldNodeObject;
}
}
return null;
@@ -30,9 +31,10 @@ public class ASMUtils implements Opcodes {
if(desc == null) {
return getField(node, fieldName);
}
for (final FieldNode fieldNode : node.fields) {
if (fieldNode.name.equals(fieldName) && fieldNode.desc.equals(desc)) {
return fieldNode;
for (final Object fieldNode : node.fields) {
FieldNode fieldNodeObject = (FieldNode) fieldNode;
if (fieldNodeObject.name.equals(fieldName) && fieldNodeObject.desc.equals(desc)) {
return fieldNodeObject;
}
}
return null;
@@ -55,9 +57,10 @@ public class ASMUtils implements Opcodes {
public static MethodNode getMethod(final ClassNode location,
final String methodName, final String methodDesc) {
for (MethodNode mn : location.methods) {
if (mn.name.equals(methodName) && mn.desc.equals(methodDesc)) {
return mn;
for (Object mn : location.methods) {
MethodNode methodNode = (MethodNode) mn;
if (methodNode.name.equals(methodName) && methodNode.desc.equals(methodDesc)) {
return methodNode;
}
}
return null;
@@ -33,7 +33,7 @@ public class AddGetterAdapter implements Opcodes, Injectable {
* - classnode to inject getter method in
* @param fieldLocation
* - classnode where field is located
* @param fieldName
* @param fieldNode
* - field name to get
* @param methodName
* - method name of getter
@@ -102,9 +102,10 @@ public class AddGetterAdapter implements Opcodes, Injectable {
.append("()");
throw new RuntimeException(sb.toString());
}
for (final MethodNode methodNode : into.methods) {
if (methodNode.name.equals(methodName)) {
final Type[] args = Type.getArgumentTypes(methodNode.desc);
for (final Object methodNode : into.methods) {
MethodNode methodNodeObject = (MethodNode) methodNode;
if (methodNodeObject.name.equals(methodName)) {
final Type[] args = Type.getArgumentTypes(methodNodeObject.desc);
if (args != null && args.length != 0) {
continue;
}
@@ -45,9 +45,10 @@ public class AddInterfaceAdapter implements Injectable {
protected static void addInterface(ClassNode node, String i) {
ASMUtils.makePublic(node);
for(MethodNode mn : node.methods) {
if(mn.name.startsWith("<init")) {
ASMUtils.makePublic(mn);
for(Object mn : node.methods) {
MethodNode methodNode = (MethodNode) mn;
if(methodNode.name.startsWith("<init")) {
ASMUtils.makePublic(methodNode);
}
}
node.interfaces.add(i);
@@ -50,10 +50,11 @@ public class Invoker implements Injectable {
}
private static MethodNode getMethod(ClassNode into, String name, String desc) {
for (MethodNode m : into.methods) {
String s = m.desc.substring(0, m.desc.indexOf(')') + 1);
if (m.name.equals(name) && s.equals(desc)) {
return m;
for (Object m : into.methods) {
MethodNode methodNode = (MethodNode) m;
String s = methodNode.desc.substring(0, methodNode.desc.indexOf(')') + 1);
if (methodNode.name.equals(name) && s.equals(desc)) {
return methodNode;
}
}
return null;