Handling circular dependency in <clinit>
Archie Cobbs
archie at whistle.com
Mon Oct 19 16:28:59 PDT 1998
Senthil Kumar writes:
> Suppose in class A's <clinit>, we instantiate class B
> and in the <init> for class B, we instantiate class A.
>
> How is this handled?
>
> As I see it, to instantiate class B in class A's <init>
> somehow the <clinit> for class A has to complete.
>
> I am at a loss to see how the JVM might be handling
> this problem.
There's no way out of this problem, and the JVM spec
allows for it by letting the JVM instantiate the A object
even though the Class A <clint> is not finished (I believe).
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
More information about the kaffe
mailing list