8007305: DPrinter: provide better usage message
authorjjg
Fri, 01 Feb 2013 08:36:15 -0800
changeset 15561 ef818953c598
parent 15560 d0509841a622
child 15562 e05336e44a9e
8007305: DPrinter: provide better usage message Reviewed-by: mcimadamore
langtools/test/tools/javac/lib/DPrinter.java
--- a/langtools/test/tools/javac/lib/DPrinter.java	Fri Feb 01 08:33:48 2013 -0800
+++ b/langtools/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");