What methods should go into a java.util.Objects class in JDK 7?
Joe Darcy
Joe.Darcy at Sun.COM
Thu Sep 10 22:48:29 UTC 2009
On 09/09/09 08:01 PM, Joe Darcy wrote:
> Martin Buchholz wrote:
>> On Wed, Sep 9, 2009 at 17:40, Joe Darcy<Joe.Darcy at sun.com> wrote:
>>
>>> PS This talk of hashing remind me of a small spec cleanup:
>>> 4245470 algorithm of java.lang.Byte.hashCode() is not specified
>>> http://bugs.sun.com/view_bug.do?bug_id=4245470
>>>
>>>
>>
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode-spec/
>>
>> Martin
>>
>
> I'll work on the archeology to verify this behavior has been
> consistent over time and thus is reasonable to tighten the spec in
> these cases.
>
> -Joe
Martin,
I noticed that the Character class should be similarly tightened:
/**
* Returns a hash code for this {@code Character}; equal to the result
* of invoking {@code intValue()}.
*
* @return a hash code value for this {@code Character}
*/
public int hashCode()
I've done some checking and all of the following Sun JDKs implement the
"intValue" hashCode for Byte, Character, and Short:
1.1
1.2
1.3.0
1.3.1
1,4.0
1.4.1
1.4.2
1.5
1.6
so I think a change to all three wrapper classes is safe to go back from
a behavioral compatibility perspective :-)
-Joe
More information about the core-libs-dev
mailing list