RFR 8009736: Comparator API cleanup
Tom Hawtin
tom.hawtin at oracle.com
Thu Jun 13 10:28:51 PDT 2013
On 12/06/2013 17:36, Paul Sandoz wrote:
> "The returned comparator is serializable and does not permit null arguments when comparing objects".
Being Serializable at all is odd. It brings the previously
implementation-dependent name and fields into the API spec.
Serialisability also allows curious behaviour. Whilst not, say, a
vulnerability itself, oddities aren't generally a good idea. For an
example of strangeness, NullComparator can have a sign of
-Integer.MIN_VALUE. It can also have a `real` field of null which is
otherwise checked for during construction, although strangely the
compare method also checks whether real is null or not.
Tom
More information about the lambda-dev
mailing list