JDK-8204981 : Deprecate pack200 and unpack200 tools, and the Pack200 API
  • Type: CSR
  • Component: tools
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-06-13
  • Updated: 2018-06-25
  • Resolved: 2018-06-18
Related Reports
CSR :  
Relates :  
Description
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.


Comments
Voting to retroactively approve this request. Note it is customary, but not strictly required, to provide some guidance on alternatives when an API is deprecated or to explicitly state there is no alternative. However, it appears that the Pack200 spec https://download.java.net/java/early_access/jdk11/docs/specs/pack-spec.html should also be updated as part of this work. Please do that under a follow-up issue.
18-06-2018

More specifically, please include an actual diff, specdiff, webrev or equivalent so that the precise API changes can be reviewed.
13-06-2018

Before this request is finalized, please have one or more other engineers review the request and submit a more detailed specification. In particular, the API deprecation should include both @Deprecated annotations as well as @deprecated javadoc tags. Moving to Provisional.
13-06-2018