This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: Eager vs Lazy resolution of classes
- From: "Jeroen Frijters" <jeroen at sumatra dot nl>
- To: "Bryce McKinlay" <mckinlay at redhat dot com>,"Chris Gray" <chris dot gray at kiffer dot be>
- Cc: <java at gcc dot gnu dot org>
- Date: Wed, 21 Jul 2004 17:09:50 +0200
- Subject: RE: Eager vs Lazy resolution of classes
Bryce McKinlay wrote:
> The issue here is whether it is ok to do the resolution
> itself eagerly, deferring errors until active use. That
> is, whether new classes can appear on the classpath at
> runtime, after the class that uses them has
> already been linked, and expect to be resolved successfully.
I think this depends to a large degree on how eager you are. IKVM is
very eager (all methods in a class have to be compiled in order to run
one method) and until I added a workaround (essentially compiling in
code that uses reflection to retry failed link actions at runtime), this
caused problems with Eclipse 2.x.
I recently rewrote I major portion of IKVM to support lazy linking much
better. This is particularly tricky for IKVM because I'm compiling to an
OO intermediate language. Suppose you have a class Base, Derived and
Foo. While Base is compiled Foo is not yet available, but when Derived
is compiled it is. The code I generate for this is something like:
class Base
{
public void method(Object /*NOTE really Foo*/ foo) { ... }
}
class Derived extends Base
{
// this overrides Base.method
private final void method(Object foo) { method((Foo)foo); }
public void method(Foo foo) { ... }
}
Regards,
Jeroen