8161338: (jdeprscan) remove JEP 293 non-conforming -cp option

8165927: (jdeprscan) com.sun.tools.jdeprscan.Main.instance should be package protected

Reviewed-by: jjg
This commit is contained in:
Stuart Marks 2016-10-04 18:43:36 -07:00
parent 5bce3820cc
commit 512c42b9ac
4 changed files with 5 additions and 21 deletions

View File

@ -89,8 +89,6 @@ import javax.lang.model.element.TypeElement;
* - 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<>();
@ -414,13 +412,6 @@ public class Main implements DiagnosticListener<JavaFileObject> {
}
}
/**
* 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.
@ -504,7 +495,6 @@ public class Main implements DiagnosticListener<JavaFileObject> {
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 @@ public class Main implements DiagnosticListener<JavaFileObject> {
* @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);
}
/**

View File

@ -39,7 +39,6 @@ JDeprScan Tool Command Reference
**OPTIONS**
-cp PATH
--class-path PATH
Sets the classpath to PATH.
@ -103,7 +102,7 @@ For example, the `Thread.State` enum would be specified using the string
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.

View File

@ -2,7 +2,7 @@ main.usage=\
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 @@ for nested classes, for example,\n\
\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\

View File

@ -74,7 +74,7 @@ public class TestScan {
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();