This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Re: Patch: remove `final' hack in String.toString()
- To: Tom Tromey <tromey at cygnus dot com>
- Subject: Re: Patch: remove `final' hack in String.toString()
- From: Corey Minyard <minyard at acm dot org>
- Date: 29 Apr 2000 16:34:49 -0500
- Cc: Bryce McKinlay <bryce at albatross dot co dot nz>, java-patches at sourceware dot cygnus dot com
- References: <39094648.E1FE7AF1@albatross.co.nz> <200004281544.IAA03728@ferrule.cygnus.com>
- Reply-To: minyard at acm dot org
This would be nice, but to maintain bug compatibility with JDK we
probably have to analyze this on a case-by-case basis. I know, for
instance, that in JDK passing a null pointer as the address to the
DatagramPacket() constructor or to DatagramPacket.setAddress() will
work fine under JDK. I also know of some code that actually requires
this behaviour to work properly.
Corey
Tom Tromey <tromey@cygnus.com> writes:
> Bryce> Now that we have a fix for PR/2, we don't need this dumb hack
> Bryce> in String.java. Checked in.
>
> There are other places that we do something similar.
> For instance, in BitSet.java:
>
> if (bs == null)
> throw new NullPointerException ();
> int max = Math.min(bits.length, bs.bits.length);
>
> We never had a very well-defined policy for this stuff.
> Right now I'm inclined to say that we should also explicitly throw a
> NullPointerException when the value is not used,
> e.g. java.io.File.File:
>
> public File (String p)
> {
> if (p == null)
> throw new NullPointerException ();
> path = p;
> }
>
> Comments?
> The idea here is that on native platforms we can rely on what we have
> now. On platforms without an MMU we'll have to modify the compiler to
> do explicit checks everywhere.
>
> Tom