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

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

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 14
    • deploy
    • None
    • source, binary
    • low
    • Applications that are still using this method, despite the warning about it being deprecated for removal, will now fail to compile or run.
    • Java API
    • JDK

      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);
          -    }
      

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Philip Race, Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: