<Beans Dev> [12] Review Request: 8211147 Incorrect comparator com.sun.beans.introspect.MethodInfo.MethodOrder
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Sat Oct 6 02:15:38 UTC 2018
Hello.
Please review the fix for jdk12.
Bug: https://bugs.openjdk.java.net/browse/JDK-8211147
Webrev: http://cr.openjdk.java.net/~serb/8211147/webrev.00
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
mailing list