classpath
[Top][All Lists]
Advanced

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

Re: Informative throws


From: Tom Tromey
Subject: Re: Informative throws
Date: 26 Jul 2001 12:23:27 -0600

>>>>> "Eric" == Eric Blake <address@hidden> writes:

Eric> I just had an idea for another configure option.  For efficiency
Eric> sake, when Classpath throws an exception, the no-arg constructor
Eric> results in fewer bytes (both in the constant pool and in the
Eric> executable code) and more speed (no string concatenation or
Eric> intern()ing).

I think that allowing this as a configuration option is desirable.  It
is the first of many things we can do to let the user build a stripped
down class library.

Eric> Then, in places like Integer.decode() (which, by the way, is
Eric> buggy at the moment)

What is wrong with Integer.decode?

BTW I'm not ignoring your other Integer patch.  I will address it as
soon as possible -- either tonight or tomorrow morning.  I apologize
for introducing the problem in the first place.

Eric>     if (str == null || (len = str.length()) == 0)
Eric>       if (Configuration.EXCEPTION_MESSAGES)
Eric>         throw new NumberFormatException("string null or empty");
Eric>       else
Eric>         throw new NumberFormatException();

My concerns with this approach are maintainability and readability.  I
wish it were easily possible to do this via some sort of preprocessing
step.

Perhaps we could do it by looking for:
    throw new [A-Za-z]+(Exception|Error)
and then removing the argument.
This could be done if our coding standard mandated how these
expressions were to be written.
That might affect readability too, though.

Tom



reply via email to

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