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

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

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 16
    • core-libs
    • None
    • minimal
    • No change to the behavior of `Proxy::newProxyInstance`.
    • Java API
    • SE

      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.

            mchung Mandy Chung (Inactive)
            mchung Mandy Chung (Inactive)
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: