Array equality, comparison and mismatch

Mike Duigou openjdk at duigou.org
Mon Oct 12 17:50:21 UTC 2015


>> On 22 Sep 2015, at 18:30, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:
>> 
>> Hi,
>> 
>> Please review the following which adds methods to Arrays for 
>> performing equality, comparison and mismatch:
>> 
>>  https://bugs.openjdk.java.net/browse/JDK-8033148
>>  
>> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexico-compare/webrev/
>>  
>> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8033148-Arrays-lexico-compare/specdiff/overview-summary.html
>> 
> 
> Updated the above with JavaDoc for all methods.
> 
> Paul.

There is a Kilimanjaro of tedium in building changes like these that are 
implemented across all the basic types. Thank you for taking this on so 
thoroughly.

A few comments.

- Inconsistent @since declarations. Both "9" and "1.9" are used. I know 
Henry Jen was working on normalizing this for the -platform javac work, 
but am uncertain what was chosen. It is perhaps time to drop the "1."

- Have you done side by side textual comparisons of the docs and 
implementations to make sure there are only expected differences of 
types and semantics (== vs equals vs compareUnsigned)? It's easy for an 
error to creep in as you go through many iterations by forgetting to 
make a fix in one implementation.

- I apologize if this was discussed earlier in the thread but why is the 
comparison of floats and doubles done by first == operator of the int 
bits and only then the compare method ? It would seem that the compare 
method could use this same technique if it wanted. Why not do the same 
for unsigned comparisons since == would also work for those?

I am *REALLY* looking forward to using these!

Mike



More information about the core-libs-dev mailing list