mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8199871: Deprecate pack200 and unpack200 tools
Reviewed-by: mchung, psandoz, abuckley
This commit is contained in:
parent
db61a602f6
commit
b026102163
17 changed files with 273 additions and 28 deletions
|
@ -54,6 +54,7 @@ import java.util.LinkedList;
|
|||
* Define the structure and ordering of "bands" in a packed file.
|
||||
* @author John Rose
|
||||
*/
|
||||
@SuppressWarnings({"removal"})
|
||||
abstract
|
||||
class BandStructure {
|
||||
static final int MAX_EFFORT = 9;
|
||||
|
|
|
@ -56,9 +56,12 @@ import java.util.zip.GZIPOutputStream;
|
|||
|
||||
/** Command line interface for Pack200.
|
||||
*/
|
||||
|
||||
@SuppressWarnings({"removal"})
|
||||
class Driver {
|
||||
private static final ResourceBundle RESOURCE =
|
||||
ResourceBundle.getBundle("com.sun.java.util.jar.pack.DriverResource");
|
||||
private static final ResourceBundle RESOURCE =
|
||||
ResourceBundle.getBundle("com.sun.java.util.jar.pack.DriverResource");
|
||||
private static boolean suppressDeprecateMsg = false;
|
||||
|
||||
public static void main(String[] ava) throws IOException {
|
||||
List<String> av = new ArrayList<>(Arrays.asList(ava));
|
||||
|
@ -67,6 +70,7 @@ class Driver {
|
|||
boolean doUnpack = false;
|
||||
boolean doRepack = false;
|
||||
boolean doZip = true;
|
||||
suppressDeprecateMsg = av.remove("-XDsuppress-tool-removal-message");
|
||||
String logFile = null;
|
||||
String verboseProp = Utils.DEBUG_VERBOSE;
|
||||
|
||||
|
@ -85,6 +89,10 @@ class Driver {
|
|||
}
|
||||
}
|
||||
|
||||
if (!suppressDeprecateMsg) {
|
||||
printDeprecateWarning(doPack, System.out);
|
||||
}
|
||||
|
||||
// Collect engine properties here:
|
||||
Map<String,String> engProps = new HashMap<>();
|
||||
engProps.put(verboseProp, System.getProperty(verboseProp));
|
||||
|
@ -394,6 +402,12 @@ class Driver {
|
|||
return tmpfile.toFile();
|
||||
}
|
||||
|
||||
private static
|
||||
void printDeprecateWarning(boolean doPack, PrintStream out) {
|
||||
String prog = doPack ? "pack200" : "unpack200";
|
||||
out.println(MessageFormat.format(RESOURCE.getString(DriverResource.DEPRECATED), prog));
|
||||
}
|
||||
|
||||
private static
|
||||
void printUsage(boolean doPack, boolean full, PrintStream out) {
|
||||
String prog = doPack ? "pack200" : "unpack200";
|
||||
|
@ -407,6 +421,11 @@ class Driver {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// Print a warning at the end
|
||||
// The full help page is long, the beginning warning could be out of sight
|
||||
if (full && !suppressDeprecateMsg) {
|
||||
printDeprecateWarning(doPack, out);
|
||||
}
|
||||
}
|
||||
|
||||
private static
|
||||
|
|
|
@ -42,6 +42,7 @@ public class DriverResource extends ListResourceBundle {
|
|||
public static final String MORE_INFO = "MORE_INFO";
|
||||
public static final String DUPLICATE_OPTION = "DUPLICATE_OPTION";
|
||||
public static final String BAD_SPEC = "BAD_SPEC";
|
||||
public static final String DEPRECATED = "DEPRECATED";
|
||||
|
||||
/*
|
||||
* The following are the output of 'pack200' and 'unpack200' commands.
|
||||
|
@ -126,6 +127,7 @@ public class DriverResource extends ListResourceBundle {
|
|||
{MORE_INFO, "(For more information, run {0} --help .)"}, // parameter 0:command name
|
||||
{DUPLICATE_OPTION, "duplicate option: {0}"}, // parameter 0:option
|
||||
{BAD_SPEC, "bad spec for {0}: {1}"}, // parameter 0:option;parameter 1:specifier
|
||||
{DEPRECATED, "\nWarning: The {0} tool is deprecated, and is planned for removal in a future JDK release.\n"} // parameter 0:command name
|
||||
};
|
||||
|
||||
protected Object[][] getContents() {
|
||||
|
|
|
@ -39,6 +39,7 @@ import java.util.zip.Deflater;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@SuppressWarnings({"removal"})
|
||||
class NativeUnpack {
|
||||
// Pointer to the native unpacker obj
|
||||
private long unpackerPtr;
|
||||
|
|
|
@ -55,7 +55,7 @@ import java.util.jar.Pack200;
|
|||
* @author Kumar Srinivasan
|
||||
*/
|
||||
|
||||
|
||||
@SuppressWarnings({"removal"})
|
||||
public class PackerImpl extends TLGlobals implements Pack200.Packer {
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,6 +47,7 @@ import java.util.jar.Pack200;
|
|||
* Control block for publishing Pack200 options to the other classes.
|
||||
*/
|
||||
|
||||
@SuppressWarnings({"removal"})
|
||||
final class PropMap implements SortedMap<String, String> {
|
||||
private final TreeMap<String, String> theMap = new TreeMap<>();;
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ import java.util.zip.ZipEntry;
|
|||
*/
|
||||
|
||||
|
||||
@SuppressWarnings({"removal"})
|
||||
public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
|
||||
|
||||
public UnpackerImpl() {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue