Summary
-------
Deprecate the pack200 and unpack200 tools, and the Pack200 API in `java.util.jar`.
Problem
-------
Pack200 is a complex and elaborate technology. The file format is tightly coupled to the class file format and the JAR file format, both of which have evolved in ways unforeseen by JSR 200. The compression benefit is not significant, and can be solved with deployment tools. Overall, the cost of maintaining Pack200 outweighs the benefit of including it in Java SE and the JDK.
Solution
--------
Deprecate the pack200, unpack200 tools and the Pack200 API, for removal in a future version. Because removal is not immediate, developers will have the opportunity to seek out alternate solutions.
Specification
-------------
The complete change can be reviewed at http://cr.openjdk.java.net/~henryjen/jdk11/8199871/4/webrev
Summary:
- Add `@deprecated` javadoc tag and `@Deprecated(forRemoval=true)` annotation to the following:
```
class java.util.jar.Pack200
interface java.util.jar.Pack200.Packer
interface java.util.jar.Pack200.Unpacker
module jdk.pack
```
```
diff -r ee8524126794 src/java.base/share/classes/java/util/jar/Pack200.java
--- a/src/java.base/share/classes/java/util/jar/Pack200.java Fri Jun 08 15:24:51 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/Pack200.java Thu Jun 14 16:32:22 2018 -0700
@@ -101,7 +101,10 @@
* @author John Rose
* @author Kumar Srinivasan
* @since 1.5
+ * @deprecated This class is deprecated, and is planned for removal in a future
+ * release.
*/
+@Deprecated(since="11", forRemoval=true)
public abstract class Pack200 {
private Pack200() {} //prevent instantiation
@@ -225,7 +228,10 @@
* to be thrown.
*
* @since 1.5
+ * @deprecated This interface is deprecated, and is planned for removal in a
+ * future release.
*/
+ @Deprecated(since="11", forRemoval=true)
public interface Packer {
/**
* This property is a numeral giving the estimated target size N
@@ -584,7 +590,10 @@
* <p>
* This version of the unpacker is compatible with all previous versions.
* @since 1.5
+ * @deprecated This interface is deprecated, and is planned for removal in a
+ * future release.
*/
+ @Deprecated(since="11", forRemoval=true)
public interface Unpacker {
/** The string "keep", a possible value for certain properties.
diff -r ee8524126794 src/jdk.pack/share/classes/module-info.java
--- a/src/jdk.pack/share/classes/module-info.java Fri Jun 08 15:24:51 2018 -0700
+++ b/src/jdk.pack/share/classes/module-info.java Thu Jun 14 16:32:01 2018 -0700
@@ -36,7 +36,10 @@
* </dl>
*
* @moduleGraph
+ * @deprecated This module is deprecated, and is planned for removal in a
+ * future release.
* @since 9
*/
+@Deprecated(since="11", forRemoval=true)
module jdk.pack {
}
```
- Add `"XXX is deprecated, and is planned for removal in a future JDK release"` warning message to output of `pack200`, `unpack200`, and `jar` when used with -n option. Sample output below:
```
$ pack200
Warning: The pack200 tool is deprecated, and is planned for removal in a future JDK release.
Usage: pack200 [-opt... | --option=value]... x.pack[.gz] y.jar
(For more information, run pack200 --help .)
$ unpack200
Warning: The unpack200 tool is deprecated, and is planned for removal in a future JDK release.
Usage: unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar
(For more information, run unpack200 --help .)
$ jar cnf Hello.jar Hello.class
Warning: The -n option is deprecated, and is planned for removal in a future JDK release
$ jar --help-extra
-n, --normalize Normalize information in the new jar archive
after creation. This option is deprecated, and is
planned for removal in a future JDK release
$ jar --help:compat
-n perform Pack200 normalization after creating a new archive,
this option is deprecated, and is planned for removal in a future JDK release
```
- A new undocumented option `-XDsuppress-tool-removal-message` is added in `pack200`, `unpack200` and `jar` tools to suppress the warning message.