Community
Participate
Working Groups
public class ErrorTest extends AbstractSet<Runnable>{ public static void main(String[] args) { ErrorTest t=new ErrorTest(); t.add(null); } public boolean add(Runnable run) { System.out.println("success"); return true; } public Iterator iterator() {return null;} public int size() {return 0;} } when tried to execute, fails with: java.lang.ClassFormatError: Repetitive method name/signature in class file ErrorTest at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:605) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
Here is the disassembled output of this .class file: // Compiled from ErrorTest.java (version 1.5 : 49.0, super bit) // Signature: Ljava/util/AbstractSet<Ljava/lang/Runnable;>; public class ErrorTest extends java.util.AbstractSet { // Method descriptor #6 ()V // Stack: 1, Locals: 1 public ErrorTest(); 0 aload_0 1 invokespecial #10 <Method java/util/AbstractSet.<init>()V> 4 return Line numbers: [pc: 0, line: 3] Local variable table: [pc: 0, pc: 5] local: this index: 0 type: LErrorTest; // Method descriptor #16 ([Ljava/lang/String;)V // Stack: 2, Locals: 2 public static void main(String[] args); 0 new #2 ErrorTest 3 dup 4 invokespecial #17 <Method ErrorTest.<init>()V> 7 astore_1 8 aload_1 9 aconst_null 10 invokevirtual #21 <Method ErrorTest.add(Ljava/lang/Runnable;)Z> 13 pop 14 return Line numbers: [pc: 0, line: 6] [pc: 8, line: 7] [pc: 14, line: 8] Local variable table: [pc: 0, pc: 15] local: args index: 0 type: [Ljava/lang/String; [pc: 8, pc: 15] local: t index: 1 type: LErrorTest; // Method descriptor #19 (Ljava/lang/Runnable;)Z // Stack: 2, Locals: 2 public boolean add(Runnable run); 0 getstatic #30 <Field java/lang/System.out Ljava/io/PrintStream;> 3 ldc #32 <String "success"> 5 invokevirtual #38 <Method java/io/PrintStream.println(Ljava/lang/String;)V> 8 iconst_1 9 ireturn Line numbers: [pc: 0, line: 11] [pc: 8, line: 12] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: LErrorTest; [pc: 0, pc: 10] local: run index: 1 type: Ljava/lang/Runnable; // Method descriptor #42 ()Ljava/util/Iterator; // Stack: 1, Locals: 1 public Iterator iterator(); 0 aconst_null 1 areturn Line numbers: [pc: 0, line: 14] Local variable table: [pc: 0, pc: 2] local: this index: 0 type: LErrorTest; // Method descriptor #44 ()I // Stack: 1, Locals: 1 public int size(); 0 iconst_0 1 ireturn Line numbers: [pc: 0, line: 15] Local variable table: [pc: 0, pc: 2] local: this index: 0 type: LErrorTest; // Method descriptor #45 (Ljava/lang/Object;)Z // Stack: 2, Locals: 2 public bridge synthetic boolean add(Object arg); 0 aload_0 1 aload_1 2 checkcast #47 java/lang/Runnable 5 invokevirtual #21 <Method ErrorTest.add(Ljava/lang/Runnable;)Z> 8 ireturn Line numbers: [pc: 0, line: 1] // Method descriptor #45 (Ljava/lang/Object;)Z // Stack: 2, Locals: 2 public bridge synthetic boolean add(Object arg); 0 aload_0 1 aload_1 2 checkcast #47 java/lang/Runnable 5 invokevirtual #21 <Method ErrorTest.add(Ljava/lang/Runnable;)Z> 8 ireturn Line numbers: [pc: 0, line: 1] } We can see that the last method is twice in the class file.
What drop are you running on?
sorry, Version: 3.1.0 Build id: 200408010010
Released a temporary fix in Head. Moving to philippe so we can discuss a better solution when he returns.
Fixed in HEAD. Test case added: GenericTypeTest#test379
Verified for 3.1 M3 with build I200411040800