This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Re: Patch: String.toString()
Tom Tromey wrote:
> FWIW I'm not entirely certain this patch is the way to go.
> Instrumenting code all over libjava to check for null seems tedious
> and error-prone. If users have to do this, too, then it is worse than
> that -- it is an actual bug.
You're right. Now that I'm fully awake I realize that this is definitely
a (serious) compiler bug. Here's a more self contained test:
public final class Final
{
public static void main(String args[])
{
Final f = null;
try
{
f.doSomething();
}
catch (NullPointerException x)
{
System.out.println("NullPointerException - ok");
}
}
void doSomething()
{
System.out.println("This should not happen");
}
}
I suppose that the compiler just needs to insert a test for this==null at
the start of each final method? I will revoke my patch as soon as
somebody comes up with a fix for this.
regards
[ bryce ]