RFR: 8336043: Add quality of implementation discussion to Object.{equals, toString, hashCode}

Joe Darcy darcy at openjdk.org
Wed Jul 10 23:19:07 UTC 2024


On Wed, 10 Jul 2024 22:54:23 GMT, Chen Liang <liach at openjdk.org> wrote:

>> First pass at adding some quality of implementation discussions around the overridable methods of Object.
>
> src/java.base/share/classes/java/lang/Object.java line 126:
> 
>> 124:      *
>> 125:      * As as a quality of implementation concern, a particular
>> 126:      * implementation of this method may or may not support generating
> 
> "may not support generating hash codes" sounds weird; maybe like "may or may not guard against cyclic data structures in recursive hash code generation."
> 
> I think the key is "recursive" here, as only recursive implementations are at risk of these faults.

Well, recursion is the easiest way to accidentally write an infinite loop, but I think a few other ones would be possible too ;-) I'll considering updating the wording to highlight the most likely hazards; thanks.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20128#discussion_r1673159791


More information about the core-libs-dev mailing list