diff options
-rwxr-xr-x | api/pom.xml | 12 | ||||
-rw-r--r-- | api/src/main/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 @@ <version>2.0.0</version> </dependency> <dependency> - <groupId>asm</groupId> + <groupId>org.ow2.asm</groupId> <artifactId>asm</artifactId> </dependency> <dependency> - <groupId>asm</groupId> + <groupId>org.ow2.asm</groupId> <artifactId>asm-commons</artifactId> </dependency> <dependency> @@ -48,14 +48,14 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>asm</groupId> + <groupId>org.ow2.asm</groupId> <artifactId>asm</artifactId> - <version>3.2</version> + <version>5.0.3</version> </dependency> <dependency> - <groupId>asm</groupId> + <groupId>org.ow2.asm</groupId> <artifactId>asm-commons</artifactId> - <version>3.2</version> + <version>5.0.3</version> </dependency> </dependencies> </dependencyManagement> 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 <a href="mailto:[email protected]">Antony Riley</a> */ -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<String, FieldInfo> 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<String, MethodInfo>(); - fieldMap = new HashMap<String, FieldInfo>(); + this.methodMap = new HashMap<String, MethodInfo>(); + this.fieldMap = new HashMap<String, FieldInfo>(); } - + /** * 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; } } |