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

Andrew Dinn adinn at redhat.com
Fri Dec 7 13:55:44 UTC 2018


On 07/12/2018 10:31, Remi Forax wrote:
> Hi Stuart,
> 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.

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the core-libs-dev mailing list