classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NotYetImplementedError [Was: NYIException]


From: Etienne Gagnon
Subject: Re: NotYetImplementedError [Was: NYIException]
Date: Sun, 28 Sep 2003 23:14:09 -0400
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.4) Gecko/20030908 Debian/1.4-4

David Holmes wrote:
I'm not so sure this is about actual version information but more
about not yet implemented methods in a VM/library that purports to
support the version of the API that includes that method. Classpath is
in the unfortunate state of supporting different versions of API's
depending on which class you are looking at, so what version
information would the system property return?

It should report Classpath's version (e.g. 0.06).

I do really think that an application should not use the exception mechanism to discover the class library version (of course, classpath 0.06 != specific sun jdk version, but this is still a version).

Throwing a error seems to be the right thing to do.

Many applications (including SableCC, I think) do things like:

try ...
catch(Exception e)
{...}

In such context, a missing method is definitely *not* an exception.

If a programmer knows that his application will be running on an incomplete/inconsistent class library, he should definitely use a system property to make the appropriate control-flow choices. In the *worst* ugly hack case, he could do a catch(NotYetImplementedError e), but this should definitely be avoided.

Throwing an error and aborting the application is the right thing to do for 99,9% of Java applications. If an application was coded expecting some method to be present, then an error should happen. This is already the case with Sun's JDK, e.g.:

An application is written for JDK 1.4. Application is run on JDK 1.1. A 1.4-specific method is called => LinkageError is thrown.


Etienne

--
Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]