<Beans Dev> [12] Review Request: 8211147 Incorrect comparator com.sun.beans.introspect.MethodInfo.MethodOrder
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Tue Oct 30 00:55:23 UTC 2018
Any volunteers to review? =)
On 05/10/2018 19:15, Sergey Bylokhov wrote:
> 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