This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Eager vs Lazy resolution of classes
- From: Andrew Haley <aph at redhat dot com>
- To: Bryce McKinlay <mckinlay at redhat dot com>
- Cc: java at gcc dot gnu dot org
- Date: Wed, 21 Jul 2004 18:58:38 +0100
- Subject: Eager vs Lazy resolution of classes
- References: <40FD8587.6020908@redhat.com>
Bryce McKinlay writes:
> The following test case creates a class on the fly in the classpath and
> then tries to call into that class statically, as opposed to via
> Class.forName() or some other classloader based mechanism.
>
> On Sun's 1.5 beta JVM, I get:
>
> $ rm Bar.class
> $ java Resolve
> start
> 99
> hello!!
Thanks, this is a fascinating bit of code. I would have guessed that
class verification of Resolve would fail, but now I see that access to
static fields in a class doesn't require that class to be loaded -- if
there is no field of that type, it will not be found.
As to whether we need to be compatible with this: IMO even if we don't
implement lazy linkage this kind around, we should at least design the
ABI so that it's possible.
Andrew.