RFR: 8340493: Fix some Asserts failure messages [v3]
Weijun Wang
weijun at openjdk.org
Thu Dec 19 12:33:43 UTC 2024
On Thu, 19 Dec 2024 03:50:59 GMT, Valerie Peng <valeriep at openjdk.org> wrote:
>> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> be precise in method spec
>
> test/lib/jdk/test/lib/Asserts.java line 448:
>
>> 446: if ((unexpected == actual) || (unexpected != null && unexpected.equals(actual))) {
>> 447: msg = Objects.toString(msg, "assertNotEquals")
>> 448: + ": expected not equals but was " + Objects.toString(actual);
>
> Given that the comparison is based on Object.equals(...), there may be (rare) cases where `a.equals(b)` returns true but `a.toString()` produces different output from `b.toString()`? To address all cases, does it make sense to compare the result of both toString() and print both in case that they are different?
I don't think this is worth doing. See my previous comment at https://github.com/openjdk/jdk/pull/21101#discussion_r1888624756.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21101#discussion_r1891845255
More information about the core-libs-dev
mailing list