8161338: (jdeprscan) remove JEP 293 non-conforming -cp option
authorsmarks
Tue, 04 Oct 2016 18:43:36 -0700
changeset 41439 ee4857e4fa85
parent 41438 5e21aa284a82
child 41440 abd777fa486c
8161338: (jdeprscan) remove JEP 293 non-conforming -cp option 8165927: (jdeprscan) com.sun.tools.jdeprscan.Main.instance should be package protected Reviewed-by: jjg
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md
langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties
langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestScan.java
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Tue Oct 04 16:47:09 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Tue Oct 04 18:43:36 2016 -0700
@@ -89,8 +89,6 @@
  *  - multi-version jar
  */
 public class Main implements DiagnosticListener<JavaFileObject> {
-    public static Main instance;
-
     final PrintStream out;
     final PrintStream err;
     final List<File> bootClassPath = new ArrayList<>();
@@ -415,13 +413,6 @@
     }
 
     /**
-     * Prints a usage message to the err stream.
-     */
-    void usage() {
-
-    }
-
-    /**
      * An enum denoting the mode in which the tool is running.
      * Different modes correspond to the different process* methods.
      * The exception is UNKNOWN, which indicates that a mode wasn't
@@ -504,7 +495,6 @@
                     args.remove();
                     switch (a) {
                         case "--class-path":
-                        case "-cp":
                             classPath.clear();
                             Arrays.stream(args.remove().split(File.pathSeparator))
                                   .map(File::new)
@@ -699,12 +689,7 @@
      * @return true on success, false otherwise
      */
     public static boolean call(PrintStream out, PrintStream err, String... args) {
-        try {
-            instance = new Main(out, err);
-            return instance.run(args);
-        } finally {
-            instance = null;
-        }
+        return new Main(out, err).run(args);
     }
 
     /**
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md	Tue Oct 04 16:47:09 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md	Tue Oct 04 18:43:36 2016 -0700
@@ -39,7 +39,6 @@
 
 **OPTIONS**
 
-        -cp PATH
         --class-path PATH
 
             Sets the classpath to PATH.
@@ -103,7 +102,7 @@
 
         java.lang.Thread$State
 
-The `--class-path` and `-cp` options specify the classpath used for
+The `--class-path` option specifies the classpath used for
 class searching. The classpath is used for classes named on the
 command line, as well as for dependencies of the classes in jar file
 or directory hierarchy to be scanned.
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties	Tue Oct 04 16:47:09 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties	Tue Oct 04 18:43:36 2016 -0700
@@ -2,7 +2,7 @@
 Usage: jdeprscan [options] '{dir|jar|class}' ...\n\
 \n\
 options:\n\
-\  -cp  --class-path PATH\n\
+\       --class-path PATH\n\
 \       --for-removal\n\
 \       --full-version\n\
 \  -h   --help\n\
@@ -20,7 +20,7 @@
 \n\
 \    java.lang.Thread$State\n\
 \n\
-The --class-path (-cp) option provides a search path for resolution\n\
+The --class-path option provides a search path for resolution\n\
 of dependent classes.\n\
 \n\
 The --for-removal option limits scanning or listing to APIs that are\n\
--- a/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestScan.java	Tue Oct 04 16:47:09 2016 -0700
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestScan.java	Tue Oct 04 18:43:36 2016 -0700
@@ -74,7 +74,7 @@
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try (PrintStream out = new PrintStream(baos, false, "UTF-8")) {
             boolean r = Main.call(out, System.err,
-                "-cp", deprcases, "--Xload-dir", deprcases, deprusage);
+                "--class-path", deprcases, "--Xload-dir", deprcases, deprusage);
             assertTrue(r);
         }
         byte[] bytes = baos.toByteArray();