RFR: 8335637: Add explicit well-behaved expectations to Object.{toString, hashCode} [v2]

Raffaello Giulietti rgiulietti at openjdk.org
Mon Jul 8 17:06:33 UTC 2024


On Mon, 8 Jul 2024 16:42:55 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> My understanding is the same. Personally, the wording reads unambiguously. The words "circular" and "circularity" can be seen throughout codebase, in similar contexts.
>> 
>> FWIW, a simpler example can be constructed like this:
>> 
>>     var list = new ArrayList<>(); 
>>     list.add(list);
>
> Changed to "cyclic/circular".
> 
> The "A" in "DAG" stands for "acyclic", but circular may be more commonly used.

While I understand and agree with the intent, we have several exceptions in the OpenJDK itself.

Circular structures that throw `StackOverflowError` on `hashCode()` and huge numbers that take 20-30 min to compute `toString()` are some examples.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20063#discussion_r1668991446


More information about the core-libs-dev mailing list