<Beans Dev> [12] Review Request: 8211147 Incorrect comparator com.sun.beans.introspect.MethodInfo.MethodOrder
Philip Race
philip.race at oracle.com
Fri Nov 30 01:32:09 UTC 2018
+1
Can you add your notes below to the bug as an evaluation.
-phil.
On 10/5/18, 7:15 PM, 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.
>
More information about the beans-dev
mailing list