From 673ee87874c055f9c20a7c402bdca21dffba9781 Mon Sep 17 00:00:00 2001 From: Simon Taddiken Date: Sat, 29 Nov 2014 14:52:53 +0100 Subject: Use newer ASM version and make it compile --- api/pom.xml | 12 +++---- .../java/org/osjava/jardiff/ClassInfoVisitor.java | 40 +++++++++++++--------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 6790346..6f2ee55 100755 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,11 +20,11 @@ 2.0.0 - asm + org.ow2.asm asm - asm + org.ow2.asm asm-commons @@ -48,14 +48,14 @@ - asm + org.ow2.asm asm - 3.2 + 5.0.3 - asm + org.ow2.asm asm-commons - 3.2 + 5.0.3 diff --git a/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java b/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java index 890b589..a01edd4 100644 --- a/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java +++ b/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java @@ -18,17 +18,18 @@ package org.osjava.jardiff; import java.util.HashMap; import java.util.Map; +import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.commons.EmptyVisitor; +import org.objectweb.asm.Opcodes; /** - * A reusable class which uses the ASM to build up ClassInfo about a + * A reusable class which uses the ASM to build up ClassInfo about a * java class file. * * @author Antony Riley */ -public class ClassInfoVisitor extends EmptyVisitor +public class ClassInfoVisitor extends ClassVisitor { /** * The class file version. @@ -50,7 +51,7 @@ public class ClassInfoVisitor extends EmptyVisitor * The signature of the class */ private String signature; - + /** * The internal name of the superclass. */ @@ -70,24 +71,28 @@ public class ClassInfoVisitor extends EmptyVisitor * A map of field signature to a FieldInfo describing the field. */ private Map fieldMap; - + + public ClassInfoVisitor() { + super(Opcodes.ASM5); + } + /** * Reset this ClassInfoVisitor so that it can be used to visit another * class. */ public void reset() { - methodMap = new HashMap(); - fieldMap = new HashMap(); + this.methodMap = new HashMap(); + this.fieldMap = new HashMap(); } - + /** * The the classInfo this ClassInfoVisitor has built up about a class */ public ClassInfo getClassInfo() { - return new ClassInfo(version, access, name, signature, supername, - interfaces, methodMap, fieldMap); + return new ClassInfo(this.version, this.access, this.name, this.signature, this.supername, + this.interfaces, this.methodMap, this.fieldMap); } - + /** * Receive notification of information about a class from ASM. * @@ -98,6 +103,7 @@ public class ClassInfoVisitor extends EmptyVisitor * @param supername the internal name of the super class. * @param interfaces the internal names of interfaces implemented. */ + @Override public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) { this.version = version; @@ -107,18 +113,20 @@ public class ClassInfoVisitor extends EmptyVisitor this.supername = supername; this.interfaces = interfaces; } - + + @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - methodMap.put(name + desc, new MethodInfo(access, name, desc, + this.methodMap.put(name + desc, new MethodInfo(access, name, desc, signature, exceptions)); return null; } - + + @Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - fieldMap.put(name, + this.fieldMap.put(name, new FieldInfo(access, name, desc, signature, value)); - return this; + return null; } } -- cgit v1.2.3 From df131d1fc3649757d1b03f7f570aee826d3d6347 Mon Sep 17 00:00:00 2001 From: Simon Taddiken Date: Sat, 29 Nov 2014 15:23:22 +0100 Subject: Revert to original formatting/code style --- .../java/org/osjava/jardiff/ClassInfoVisitor.java | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java b/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java index a01edd4..be7d08b 100644 --- a/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java +++ b/api/src/main/java/org/osjava/jardiff/ClassInfoVisitor.java @@ -24,7 +24,7 @@ import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; /** - * A reusable class which uses the ASM to build up ClassInfo about a + * A reusable class which uses the ASM to build up ClassInfo about a * java class file. * * @author Antony Riley @@ -51,7 +51,7 @@ public class ClassInfoVisitor extends ClassVisitor * The signature of the class */ private String signature; - + /** * The internal name of the superclass. */ @@ -71,28 +71,28 @@ public class ClassInfoVisitor extends ClassVisitor * A map of field signature to a FieldInfo describing the field. */ private Map fieldMap; - + public ClassInfoVisitor() { super(Opcodes.ASM5); } - + /** * Reset this ClassInfoVisitor so that it can be used to visit another * class. */ public void reset() { - this.methodMap = new HashMap(); - this.fieldMap = new HashMap(); + methodMap = new HashMap(); + fieldMap = new HashMap(); } - + /** * The the classInfo this ClassInfoVisitor has built up about a class */ public ClassInfo getClassInfo() { - return new ClassInfo(this.version, this.access, this.name, this.signature, this.supername, - this.interfaces, this.methodMap, this.fieldMap); + return new ClassInfo(version, access, name, signature, supername, + interfaces, methodMap, fieldMap); } - + /** * Receive notification of information about a class from ASM. * @@ -103,7 +103,6 @@ public class ClassInfoVisitor extends ClassVisitor * @param supername the internal name of the super class. * @param interfaces the internal names of interfaces implemented. */ - @Override public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) { this.version = version; @@ -117,15 +116,15 @@ public class ClassInfoVisitor extends ClassVisitor @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - this.methodMap.put(name + desc, new MethodInfo(access, name, desc, + methodMap.put(name + desc, new MethodInfo(access, name, desc, signature, exceptions)); return null; } - + @Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - this.fieldMap.put(name, + fieldMap.put(name, new FieldInfo(access, name, desc, signature, value)); return null; } -- cgit v1.2.3