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

Proxy::newProxyInstance spec should specify the behavior if a given proxy interface is hidden

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 16
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      No change to the behavior of `Proxy::newProxyInstance`.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Update the spec of Proxy::newProxyInstance to specify `IllegalArgumentException thrown if a given proxy interface is hidden.

      Problem

      The current spec of Proxy::newProxyInstance throws IAE if a given proxy interface cannot be found by the given class loader. This covers for the case of a hidden proxy interface since it is not discoverable by any class loader. It should explicitly list in the restrictions section that the given interfaces must be non-hidden interfaces.

      Solution

      Update the spec of Proxy::newProxyInstance to require all proxy interfaces be non-hidden. There is no behavioral change. The current implementation already throws IAE if any one of the given interfaces is hidden.

      Specification

      Update the spec of Proxy::newProxyInstance

            * <a id="restrictions">{@code IllegalArgumentException} will be thrown
            * if any of the following restrictions is violated:</a>
            * <ul>
            * <li>All of {@code Class} objects in the given {@code interfaces} array
      -     * must represent interfaces, not classes or primitive types.
      +     * must represent {@linkplain Class#isHidden() non-hidden} interfaces,
      +     * not classes or primitive types.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mchung Mandy Chung
                Reporter:
                mchung Mandy Chung
                Reviewed By:
                Alan Bateman
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: