Patch to avoid SegFault in

Jeff Sturm
Mon Jul 16 05:07:00 GMT 2001

On Mon, 16 Jul 2001, Martin Kahlert wrote:
> Can you tell me, what i have to do in order to get an uninitialized
> class for an instanceof test?

See the test case at the end of this message.  With the JDK it will print:


Class B is uninitialized prior to the instanceof operator.  Note that
libgcj gets this wrong without your patch.

> Is there a deeper reason at all, why the classloader should be allowed 
> to return an uninitialized class? If not, the _Jv_InitClass would be
> superflous.

That's just how Java classloaders work.  It is described extensively
(if not exactly) in the JLS.

public class A {
  static B b;
  public static void main(String[] args) {
    System.out.println(b instanceof B);

class B {
  static {

More information about the Java mailing list