Skip to Main Content

Why doesn't this code run?

843793May 13 2003 — edited May 14 2003
I'm just experimenting with the JSR14 generics release, but am having problems. The code below is abstracted from my application. It compiles ok, but gives a runtime error:

import java.util.*;
class A {
public static void main (String argv[]) {
ArrayList<Boolean> B = new ArrayList<Boolean>(10);
Iterator<Boolean> i = B.iterator();
boolean b = (i.next()).booleanValue();
}
}

The error is:

Exception in thread "main" java.lang.VerifyError: (class: A, method: main signature: ([Ljava/lang/String;)V) Incompatible object argument for function call


If I remove the generics code, and add the required cast, the error disappears. Anyone know what is causing this?

thanks,

Gareth
Comments
Post Details
Added on May 13 2003
5 comments
52 views