JDK-8207181 : MethodHandleProxies.asInterfaceInstance does not support default methods
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 12
  • Submitted: 2018-07-12
  • Updated: 2018-08-03
  • Resolved: 2018-08-03
Related Reports
CSR :  
Description
Summary
-------


Problem
-------

MethodHandleProxies.asInterfaceInstance does not support default methods and does not mention such methods with regards to selection of the uniquely named method.

Solution
--------

Refer to default methods with regards to selection of the uniquely named method.

Specification
-------------

    diff -r 61f5673d6d02 src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java
    --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java     Tue Jul 10 12:22:07 2018 -0700
    +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java     Wed Jul 11 11:05:36 2018 -0700
    @@ -52,8 +54,10 @@
          * A single-method interface is an interface which declares a uniquely named method.
          * When determining the uniquely named method of a single-method interface,
          * the public {@code Object} methods ({@code toString}, {@code equals}, {@code hashCode})
    -     * are disregarded.  For example, {@link java.util.Comparator} is a single-method interface,
    -     * even though it re-declares the {@code Object.equals} method.
    +     * are disregarded as are any default (non-abstract) methods.
    +     * For example, {@link java.util.Comparator} is a single-method interface,
    +     * even though it re-declares the {@code Object.equals} method and also
    +     * declares default methods, such as {@code Comparator.reverse}.
          * <p>
          * The interface must be public.  No additional access checks are performed.
          * <p>


Comments
Moving to Approved.
03-08-2018