changeset 1849:6df931ce1a81

8007305: DPrinter: provide better usage message Reviewed-by: mcimadamore
author jjg
date Fri, 01 Feb 2013 08:36:15 -0800
parents 8590c20af3ce
children 0b1c88705568
files test/tools/javac/lib/DPrinter.java
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/tools/javac/lib/DPrinter.java	Fri Feb 01 08:33:48 2013 -0800
+++ b/test/tools/javac/lib/DPrinter.java	Fri Feb 01 08:36:15 2013 -0800
@@ -1087,21 +1087,30 @@
      */
     static class Main {
         public static void main(String... args) throws IOException {
+            Main m = new Main();
             PrintWriter out = new PrintWriter(System.out);
             try {
                 if (args.length == 0)
-                    usage(out);
+                    m.usage(out);
                 else
-                    new Main().run(out, args);
+                    m.run(out, args);
             } finally {
                 out.flush();
             }
         }
 
-        static void usage(PrintWriter out) {
+        void usage(PrintWriter out) {
             out.println("Usage:");
             out.println("  java " + Main.class.getName() + " mode [options] [javac-options]");
-            out.println("where options include:");
+            out.print("where mode is one of: ");
+            String sep = "";
+            for (Handler h: getHandlers().values()) {
+                out.print(sep);
+                out.print(h.name);
+                sep = ", ";
+            }
+            out.println();
+            out.println("and where options include:");
             out.println("  -before PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
             out.println("  -after PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
             out.println("  -showPositions");