JDK-8338250 : Deprecate jdk.jsobject module for removal
  • Type: CSR
  • Component: deploy
  • Priority: P4
  • Status: Proposed
  • Resolution: Unresolved
  • Fix Versions: 24
  • Submitted: 2024-08-12
  • Updated: 2024-10-04
Related Reports
CSR :  
Relates :  
Description
Summary
-------

Deprecate the jdk.jsobject module for removal. This module will be included with JavaFX.

Problem
-------

`jdk.jsobject` is a legacy JDK module that delivers a single package, `netscape.javascript`. It is not used by the JDK. It is only used by JavaFX WebView for Java <--> JavaScript interoperation. Prior to JDK 11, it was also used by the LiveConnect feature of Java Plug-In to allow applets to communicate with the hosting web page. JavaFX, which was unbundled from the JDK in 11, is the only remaining client of the `jdk.jsobject` APIs.

Solution
--------

Deprecate the `jdk.jsobject` module, and all exported types in that module, for removal in a future release. Deliver a copy of the `jdk.jsobject module` as part of the JavaFX distribution -- see [JDK-8338249](https://bugs.openjdk.org/browse/JDK-8338249). Further, make `jdk.jsobject` an upgradable module in the JDK.

Developers who use the JavaFX modular jars to compile and run their application can specify the `--upgrade-module-path` option when running `java` or `javac` to use the version of the `jdk.jsobject` module delivered with JavaFX and avoid the removal warnings. Applications that use the JavaFX modular jars and do not specify `--upgrade-module-path` will use the version of the `jdk.jsobject` from the JDK and see the removal warning at compile time. The application will otherwise continue to run normally.

Applications that use `jlink` with the module path pointing to the JavaFX `jmods` will pick up the version of the `jdk.jsobject` module delivered with JavaFX and avoid the removal warnings by default. If the JDK jmod files are put on the module path ahead of the JavaFX `jmod` files, `jlink` will pick up the one from the JDK; applications that use `javac` from that JDK will see the removal warning at compile time.


Specification
-------------

Deprecate for removal the `jdk.jsobject` module, and all public types in the `netscape.javascript` package by adding the following `@deprecated` javadoc tag and `@Deprecated` annotation:

```
+ * @deprecated The jdk.jsobject module will be delivered with JavaFX.
  */
+@Deprecated(since = "24", forRemoval = true)
```

Additionally, add the following documentation to the netscape.javascript package-info:

```
+ * <p>
+ * <b>Deprecated, for removal: This API element is subject to removal
+ * in a future version.</b><br>
+ * <em>The jdk.jsobject module will be delivered with JavaFX.</em>
+ * </p>
```

Also, make `jdk.jsobject` an upgradable module in the JDK.

See the attached file apidiff-8311530.zip file for the complete specification.