On Mon, 26 Oct 2026 10:04:50 GMT, Jaikiran Pai <[email protected]> wrote:

>> Fix port comparison in `java.net.URI::compareTo` and increase the test 
>> coverage.
>> 
>> `open/test/jdk/java/net/URI/Test.java` is improved in following aspects:
>> 
>> - Old `gt(u, v)` was delegating to `lt(v, u)`. This left `u.compareTo(v) > 
>> 0` path unchecked.
>> - `eqHashCompUni(u, v)` is introduced to verify all `equals()`, 
>> `hashCode()`, `compareTo()` contracts.
>> - `eqHashCompBid(u, v)` is introduced to verify `eqHashCompUni(u, v)` 
>> bidirectionally.
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> test/jdk/java/net/URI/Test.java line 1426:
> 
>> 1424:      * {@code >}, {@code =}, and {@code !=}.
>> 1425:      */
>> 1426:     private static void eqHashCompBid(Object s, Object t, String 
>> expectedRelation)
> 
> Nit - I think it would be better to change the method to accept only `URI` 
> instances, instead of `Object`, and then have the call sites convert the 
> `String` to `URI`.

Another nit - instead of `expectedRelation` being a `String`, perhaps make it a 
`enum`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33232#discussion_r4376057048

Reply via email to