JDK-8222677 : Remove terminally deprecated method netscape.javascript.JSObject::getWindow
  • Type: CSR
  • Component: deploy
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 14
  • Submitted: 2019-04-17
  • Updated: 2019-06-25
  • Resolved: 2019-06-25
Related Reports
CSR :  
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);
    -    }

```
Comments
A release note seems a good idea. I'll add one. Thanks.
25-06-2019

Moving to Approved; please consider whether or not a release note is appropriate.
25-06-2019

[~kcr][~darcy] This seems like a fine idea to me.
25-06-2019

Paging [~smarks]! Moving to Provisional.
17-06-2019