Review needed for 7037085 : Add hashCode() to Timestamp to address Findbugs warning
Lance Andersen - Oracle
lance.andersen at oracle.com
Fri Apr 15 19:45:04 UTC 2011
Hi Eamonn
The javadocs for Timestamp have always specifically called the following blurb out in the class description. Based on some side discussions, it was best to also copy this blurb to the added hashCode method (you will see the text at the top of Timestamp) for additional clarity.
Regards
Lance
On Apr 15, 2011, at 3:37 PM, Eamonn McManus wrote:
> This isn't wrong, but wouldn't it be simpler to just add or xor the nanos field into the hashcode, rather than explicitly saying that you don't?
> Éamonn
>
> On 15/4/11 8:54 PM, Lance Andersen - Oracle wrote:
>>
>> Hi all,
>>
>> Need a reviewer for the following minor change which adds hasCode() to Timestamp to address a Findbugs warning.
>>
>> Regards
>> Lance
>>
>>
>> hg diff
>> diff -r d9248245a88c src/share/classes/java/sql/Timestamp.java
>> --- a/src/share/classes/java/sql/Timestamp.java Wed Apr 13 11:21:36 2011 -0400
>> +++ b/src/share/classes/java/sql/Timestamp.java Fri Apr 15 14:34:07 2011 -0400
>> @@ -1,5 +1,5 @@
>> /*
>> - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
>> + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>> *
>> * This code is free software; you can redistribute it and/or modify it
>> @@ -515,6 +515,18 @@
>> }
>> }
>>
>> + /**
>> + * {@inheritDoc}
>> + *
>> + * The {@code hashcode} method uses the underlying {@code java.util.Date}
>> + * implementation and therefore does not include nanos in its computation.
>> + *
>> + */
>> + @Override
>> + public int hashCode() {
>> + return super.hashCode();
>> + }
>> +
>> static final long serialVersionUID = 2745179027874758501L;
>>
>> }
>>
>>
>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
>> Oracle Java Engineering
>> 1 Network Drive
>> Burlington, MA 01803
>> Lance.Andersen at oracle.com
>>
Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com
More information about the core-libs-dev
mailing list