Blocks :
|
|
Relates :
|
Summary ------- Deprecate the `pack200` and `unpack200` tools, and the `Pack200` API in `java.util.jar`. Motivation ------ [Pack200](https://docs.oracle.com/javase/10/docs/specs/pack-spec.html) is a compression scheme for JAR files. It was introduced in Java SE 5.0 by [JSR 200](https://jcp.org/en/jsr/detail?id=200). Its goal is "to decrease disk and bandwidth requirements for Java application packaging, transmission, and delivery." Developers use a pair of tools -- `pack200` and `unpack200` -- to [compress](https://docs.oracle.com/javase/10/tools/pack200.htm) and [uncompress](https://docs.oracle.com/javase/10/tools/unpack200.htm) their JAR files. [An API](https://docs.oracle.com/javase/10/docs/api/java/util/jar/Pack200.html) is available in the `java.util.jar` package. There are three reasons for wanting to deprecate (and eventually remove) Pack200: 1. Historically, slow downloads of the JDK over 56k modems were an impediment to Java adoption. The relentless growth in JDK functionality caused the download size to swell, further impeding adoption. Compressing the JDK with Pack200 was a way to mitigate the problem. However, time has moved on: download speeds have improved, and JDK 9 introduced new compression schemes for both the Java runtime ([JEP 220](http://openjdk.java.net/jeps/220)) and the modules used to build the runtime ([JMOD](http://openjdk.java.net/jeps/261#Packaging:-JMOD-files)). Consequently, JDK 9 and later do not rely on Pack200; JDK 8 was the last release compressed with `pack200` at build time and uncompressed with `unpack200` at install time. In summary, a major consumer of Pack200 -- the JDK itself -- no longer needs it. 2. Beyond the JDK, it was attractive to compress client applications, and especially applets, with Pack200. Some deployment technologies, such as Oracle's browser plug-in, would uncompress applet JARs automatically. However, the landscape for client applications has changed, and most browsers have dropped support for plug-ins. Consequently, a major class of consumers of Pack200 -- applets running in browsers -- are no longer a driver for including Pack200 in the JDK. 3. Pack200 is a complex and elaborate technology. Its [file format](https://docs.oracle.com/javase/10/docs/specs/pack-spec.html) is tightly coupled to the [class file format](https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.1) and the [JAR file format](https://docs.oracle.com/javase/10/docs/specs/jar/jar.html), both of which have evolved in ways unforeseen by JSR 200. (For example, [JEP 309](http://openjdk.java.net/jeps/309) added a new kind of constant pool entry to the class file format, and [JEP 238](http://openjdk.java.net/jeps/238) added versioning metadata to the JAR file format.) The implementation in the JDK is split between Java and native code, which makes it hard to maintain. The API in `java.util.jar.Pack200` was detrimental to the modularization of the Java SE Platform, leading to [the removal of four of its methods in Java SE 9](http://cr.openjdk.java.net/~iris/se/9/java-se-9-fr-spec/#APIs-removed). Overall, the cost of maintaining Pack200 is significant, and outweighs the benefit of including it in Java SE and the JDK. Description ------ Three types in the `java.base` module will be terminally deprecated, that is, annotated with `@Deprecated(forRemoval=true)`: - `java.util.jar.Pack200` - `java.util.jar.Pack200.Packer` - `java.util.jar.Pack200.Unpacker` The `jdk.pack` module, which contains the `pack200` and `unpack200` tools, will also be terminally deprecated. Running `pack200` or `unpack200` will display a warning about the planned removal of the tool. Running `jar -c` with the sub-option `n` (to [normalize the archive](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jar.html)) will display a warning about the planned removal of the sub-option. The documentation for all three tools will indicate the deprecation and planned removal. A separate JEP will be filed for the actual removal of the types and module in a future JDK feature release. Risks and Assumptions ----- It is assumed that developers who use `pack200` to shrink application JARs will switch to the `jlink` tool to create application-specific runtimes with an optimized form factor. See the [tool documentation](https://docs.oracle.com/javase/10/tools/jlink.htm) and [JEP 282](http://openjdk.java.net/jeps/282). Another option may be the `jpackage` tool ([JEP 343](http://openjdk.java.net/jeps/343)).