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

Remove terminally deprecated method netscape.javascript.JSObject::getWindow

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 14
    • Component/s: deploy
    • Labels:
      None
    • Compatibility Kind:
      source, binary
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      Applications that are still using this method, despite the warning about it being deprecated for removal, will now fail to compile or run.
    • Interface Kind:
      Java API
    • Scope:
      JDK

      Description

      Summary

      Remove the getWindow(Applet) method from the netscape.javascript.JSObject class.

      Problem

      The JSObject::getWindow method has been deprecated since JDK 9. With the removal of Java Plugin in JDK 11, there is no longer a useful way to use this method; it always returns null. It was deprecated for-removal in JDK 12. The presence of this method causes an otherwise unneeded dependency on the java.desktop module by the jdk.jsobject module.

      Solution

      We will remove the netscape.javascript.JSObject::getWindow(Applet) method along with the (not exported) service provider interface that was used by getWindow; as of JDK 11 there are no implementations of this provider. We will also remove the dependency on the java.desktop module from the module-info.java file of the jdk.jsobject module.

      Webrev: http://cr.openjdk.java.net/~kcr/8222563/webrev.00/

      Specification

          --- a/src/jdk.jsobject/share/classes/module-info.java
          +++ b/src/jdk.jsobject/share/classes/module-info.java
          @@ -30,9 +30,5 @@
            * @since 9
            */
           module jdk.jsobject {
          -    requires java.desktop;
          -
               exports netscape.javascript;
          -
          -    uses jdk.internal.netscape.javascript.spi.JSObjectProvider;
           }
      
          --- a/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java
          +++ b/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java
          @@ -139,52 +137,4 @@
                */
               public abstract void setSlot(int index, Object value) throws JSException;
      
          -    /**
          -     * Returns a JSObject for the window containing the given applet. This
          -     * method only works when the Java code is running in a browser as an
          -     * applet. The object returned may be used to access the HTML DOM directly.
          -     *
          -     * @param applet The applet.
          -     * @return JSObject representing the window containing the given applet or
          -     * {@code null} if we are not connected to a browser.
          -     * @throws JSException when an error is reported from the browser or
          -     * JavaScript engine or if applet is {@code null}
          -     *
          -     * @deprecated The Applet API is deprecated, no replacement. See the
          -     * <a href="{@docRoot}/java.desktop/java/applet/package-summary.html">
          -     * java.applet package documentation</a> for further information.
          -     */
          -
          -    @Deprecated(since="9", forRemoval=true)
          -    @SuppressWarnings("exports")
          -    public static JSObject getWindow(Applet applet) throws JSException {
          -        return ProviderLoader.callGetWindow(applet);
          -    }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kcr Kevin Rushforth
                Reporter:
                kcr Kevin Rushforth
                Reviewed By:
                Philip Race, Stuart Marks
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: