This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Eager vs Lazy resolution of classes
On Wednesday 21 July 2004 16:01, Bryce McKinlay wrote:
> Chris Gray wrote:
> >It became clear that Java developers think it normal that a class which
> > contains references to all sorts of non-existent classes should run just
> > fine provided those code paths are never traversed. So my guess is that
> > this one will come to bite you sooner rather than later.
>
> This is a different issue. There is no problem with unresolvable
> references on code paths which are never actually traversed, because the
> spec requires that such errors are not thrown until active use. The
> BC-ABI was designed for this from the outset.
OK, that's fine. From my experience you'll also need to to tolerate
unrsolvable types as arguments of methods that are never called, interface
methods which a class should implement but doesn't (but the methods are never
called), etc., all in the name of robustness in the face of version skew.
> 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.
IMO any code that relies on this behaviour is broken. If that means that some
Eclipse 2.x versions were broken and Eclipse 3 is not, then that shows that
the Eclipse guys are learning as they go along.
Chris
--
Chris Gray /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi http://www.kiffer.be/k/
chris.gray@kiffer.be +32 3 216 0369