RFR(xs): 8199394: Object.hashCode should not mention anything about memory addresses

Stuart Marks stuart.marks at oracle.com
Fri Dec 7 17:52:44 UTC 2018



On 12/7/18 5:55 AM, Andrew Dinn wrote:
> On 07/12/2018 10:31, Remi Forax wrote:
>> what about adding "tries to" to the @implSpec section
>>
>> As much as is reasonably practical, the {@code hashCode} method defined
>> by class {@code Object} tries to return distinct integers for distinct objects.
> 
> An algorithm can try? I suspect not until we reach the singularity so
> beloved of sci-fi hacks (I'm not holding my breath). So, in the
> interests of precisely nailing the colour of this bike-shed and modulo
> any unforeseen developments in Artificial Intelligence, I'd suggest this
> psychologism-free alternative:
> 
> As far as is reasonably practical, the {@code hashCode} method defined
> by class {@code Object} returns distinct integers for distinct objects.

Hi Andrew,

I agree, anthropomorphisms in documentation sound quite odd. Also, "as far as" 
is an improvement. I'll use your suggestion.

Thanks,

s'marks


More information about the core-libs-dev mailing list