added check that labels are not reused across methods (inside same class; check for labels reuse across classes still missing)
diff --git a/src/org/objectweb/asm/util/CheckClassAdapter.java b/src/org/objectweb/asm/util/CheckClassAdapter.java
index 99725ed..c1c73ad 100644
--- a/src/org/objectweb/asm/util/CheckClassAdapter.java
+++ b/src/org/objectweb/asm/util/CheckClassAdapter.java
@@ -32,8 +32,10 @@
import java.io.FileInputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.FieldVisitor;
@@ -139,6 +141,12 @@
* <tt>true</tt> if the visitEnd method has been called.
*/
private boolean end;
+
+ /**
+ * The already visited labels. This map associate Integer values to Label
+ * keys.
+ */
+ private Map labels;
/**
* Checks a given class. <p> Usage: CheckClassAdapter <fully qualified
@@ -261,6 +269,7 @@
*/
public CheckClassAdapter(final ClassVisitor cv) {
super(cv);
+ labels = new HashMap();
}
// ------------------------------------------------------------------------
@@ -416,7 +425,7 @@
name,
desc,
signature,
- exceptions));
+ exceptions), labels);
}
public AnnotationVisitor visitAnnotation(
diff --git a/src/org/objectweb/asm/util/CheckMethodAdapter.java b/src/org/objectweb/asm/util/CheckMethodAdapter.java
index 4a20985..b14f06a 100644
--- a/src/org/objectweb/asm/util/CheckMethodAdapter.java
+++ b/src/org/objectweb/asm/util/CheckMethodAdapter.java
@@ -315,8 +315,18 @@
* @param cv the code visitor to which this adapter must delegate calls.
*/
public CheckMethodAdapter(final MethodVisitor cv) {
+ this(cv, new HashMap());
+ }
+
+ /**
+ * Constructs a new {@link CheckMethodAdapter} object.
+ *
+ * @param cv the code visitor to which this adapter must delegate calls.
+ * @param labels a map of already visited labels (in other methods).
+ */
+ public CheckMethodAdapter(final MethodVisitor cv, final Map labels) {
super(cv);
- this.labels = new HashMap();
+ this.labels = labels;
}
public AnnotationVisitor visitAnnotation(