Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)
Ulf Zibis
Ulf.Zibis at gmx.de
Thu Mar 4 21:10:18 UTC 2010
Am 04.03.2010 03:08, schrieb Jason Mehrens:
> String.hash should only have two known states, zero and the actual
> computed hash code.
>
> http://bugs.sun.com/view_bug.do?bug_id=6611830
I far theory yes.
But have you read the evaluation ?
"This bug pattern is endemic in the JDK sources."
-Ulf
>
> Jason
>
>
> > Date: Sun, 28 Feb 2010 17:09:15 +0100
> > From: Ulf.Zibis at gmx.de
> > To: Alan.Bateman at Sun.COM
> > Subject: Re: Need reviewer for forward port of 6815768
> (File.getXXXSpace) and 6815768 (String.hashCode)
> > CC: core-libs-dev at openjdk.java.net; dmitry.nadezhin at gmail.com;
> Kelly.Ohair at Sun.COM
> >
> > Another thought:
> >
> > In the constructors of String we could initialize hash =
> > Integer.MIN_VALUE except if length == 0.
> > Then we could stay at the fastest version:
> >
> > public int hashCode() {
> > int h = hash;
> > if (h == Integer.MIN_VALUE) {
> > h = 0;
> > char[] val = value;
> > for (int i = offset, limit = count + i; i != limit; )
> > h = 31 * h + val[i++];
> > hash = h;
> > }
> > return h;
> > }
>
> ------------------------------------------------------------------------
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign
> up now. <http://clk.atdmt.com/GBL/go/201469226/direct/01/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100304/c43d777e/attachment.html>
More information about the core-libs-dev
mailing list