<Beans Dev>  Review Request: 8211147 Incorrect comparator com.sun.beans.introspect.MethodInfo.MethodOrder
Sergey.Bylokhov at oracle.com
Sat Oct 6 02:15:38 UTC 2018
Please review the fix for jdk12.
From the bug description:
The "MethodInfo.MethodOrder" comparator violates its contract
compare(x, y) == -(compare(y, x)) for all (x, y), so sort which use this
comparator can throw IllegalArgumentException.
The reason is how this comparator compare the return types of the
methods. The code assumes that if two methods have the same names then
one of the return type should be subtype of another, because of
covariant return types. An example in this bug shows that it is not
necessary correct, which means that this method may always returns "-1"
if two return types are unrelated.
Note that this class was particularly copied from
com.sun.jmx.mbeanserver.MethodOrder which looks like has the same bug,
I'll file a separate bug for it.
Best regards, Sergey.
More information about the beans-dev