Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8207181

MethodHandleProxies.asInterfaceInstance does not support default methods

    Details

    • Type: CSR
    • Status: Draft
    • Priority: P4
    • Resolution: Unresolved
    • Fix Version/s: 12
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      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>

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psandoz Paul Sandoz
                Reporter:
                webbuggrp Webbug Group
                Reviewed By:
                Mandy Chung
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: