8161019: javac, fold formatter options
authorvromero
Tue, 26 Jul 2016 07:45:29 -0700
changeset 39812 6272642715a1
parent 39811 b8d3d2487379
child 39813 51ebc7e80aee
8161019: javac, fold formatter options Reviewed-by: mcimadamore, jjg
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
langtools/test/tools/javac/Diagnostics/6722234/T6722234a.java
langtools/test/tools/javac/Diagnostics/6722234/T6722234b.java
langtools/test/tools/javac/Diagnostics/6722234/T6722234c.java
langtools/test/tools/javac/Diagnostics/6722234/T6722234d.java
langtools/test/tools/javac/Diagnostics/6769027/T6769027.java
langtools/test/tools/javac/Diagnostics/6862608/T6862608a.java
langtools/test/tools/javac/Diagnostics/6862608/T6862608b.java
langtools/test/tools/javac/Diagnostics/7010608/Test.java
langtools/test/tools/javac/Diagnostics/8010387/T8010387.java
langtools/test/tools/javac/InterfaceMemberClassModifiers.java
langtools/test/tools/javac/T5003235/T5003235a.java
langtools/test/tools/javac/T5003235/T5003235b.java
langtools/test/tools/javac/T6214885.java
langtools/test/tools/javac/api/6731573/T6731573.java
langtools/test/tools/javac/diags/CheckResourceKeys.java
langtools/test/tools/javac/diags/examples/WhereCaptured.java
langtools/test/tools/javac/diags/examples/WhereCaptured1.java
langtools/test/tools/javac/diags/examples/WhereFreshTvar.java
langtools/test/tools/javac/diags/examples/WhereIntersection.java
langtools/test/tools/javac/diags/examples/WhereIntersection2.java
langtools/test/tools/javac/diags/examples/WhereTypeVar.java
langtools/test/tools/javac/diags/examples/WhereTypeVar2.java
langtools/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.java
langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess2.java
langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess3.java
langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess4.java
langtools/test/tools/javac/unicode/UnicodeNewline.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Tue Jul 26 07:45:29 2016 -0700
@@ -449,7 +449,7 @@
             ? CompileState.valueOf(options.get("shouldstop.ifNoError"))
             : CompileState.GENERATE;
 
-        if (options.isUnset("oldDiags"))
+        if (options.isUnset("diags.legacy"))
             log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context));
 
         PlatformDescription platformProvider = context.get(PlatformDescription.class);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Tue Jul 26 07:45:29 2016 -0700
@@ -346,21 +346,6 @@
         }
     },
 
-    DIAGS("-XDdiags=", null, HIDDEN, INFO) {
-        @Override
-        public boolean process(OptionHelper helper, String option) {
-            option = option.substring(option.indexOf('=') + 1);
-            String diagsOption = option.contains("%") ?
-                "-XDdiagsFormat=" :
-                "-XDdiags=";
-            diagsOption += option;
-            if (XD.matches(diagsOption))
-                return XD.process(helper, diagsOption);
-            else
-                return false;
-        }
-    },
-
     HELP("-help", "opt.help", STANDARD, INFO) {
         @Override
         public boolean process(OptionHelper helper, String option) {
@@ -506,30 +491,6 @@
 
     XDIAGS("-Xdiags:", "opt.diags", EXTENDED, BASIC, ONEOF, "compact", "verbose"),
 
-    /* This is a back door to the compiler's option table.
-     * -XDx=y sets the option x to the value y.
-     * -XDx sets the option x to the value x.
-     */
-    XD("-XD", null, HIDDEN, BASIC) {
-        @Override
-        public boolean matches(String s) {
-            return s.startsWith(text);
-        }
-        @Override
-        public boolean process(OptionHelper helper, String option) {
-            return process(helper, option, option.substring(text.length()));
-        }
-
-        @Override
-        public boolean process(OptionHelper helper, String option, String arg) {
-            int eq = arg.indexOf('=');
-            String key = (eq < 0) ? arg : arg.substring(0, eq);
-            String value = (eq < 0) ? arg : arg.substring(eq+1);
-            helper.put(key, value);
-            return false;
-        }
-    },
-
     XDEBUG("-Xdebug:", null, HIDDEN, BASIC) {
         @Override
         public boolean process(OptionHelper helper, String option) {
@@ -556,6 +517,37 @@
         }
     },
 
+    DIAGS("-diags:", null, HIDDEN, BASIC, true) {
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            return HiddenGroup.DIAGS.process(helper, option);
+        }
+    },
+
+    /* This is a back door to the compiler's option table.
+     * -XDx=y sets the option x to the value y.
+     * -XDx sets the option x to the value x.
+     */
+    XD("-XD", null, HIDDEN, BASIC) {
+        @Override
+        public boolean matches(String s) {
+            return s.startsWith(text);
+        }
+        @Override
+        public boolean process(OptionHelper helper, String option) {
+            return process(helper, option, option.substring(text.length()));
+        }
+
+        @Override
+        public boolean process(OptionHelper helper, String option, String arg) {
+            int eq = arg.indexOf('=');
+            String key = (eq < 0) ? arg : arg.substring(0, eq);
+            String value = (eq < 0) ? arg : arg.substring(eq+1);
+            helper.put(key, value);
+            return false;
+        }
+    },
+
     XADDEXPORTS("-XaddExports:", "opt.arg.addExports", "opt.addExports", EXTENDED, BASIC) {
         @Override
         public boolean process(OptionHelper helper, String option) {
@@ -672,6 +664,26 @@
         ANYOF
     }
 
+    enum HiddenGroup {
+        DIAGS("diags");
+
+        final String text;
+
+        HiddenGroup(String text) {
+            this.text = text;
+        }
+
+        public boolean process(OptionHelper helper, String option) {
+            String p = option.substring(option.indexOf(':') + 1).trim();
+            String[] subOptions = p.split(";");
+            for (String subOption : subOptions) {
+                subOption = text + "." + subOption.trim();
+                XD.process(helper, subOption, subOption);
+            }
+            return false;
+        }
+    }
+
     public final String text;
 
     final OptionKind kind;
@@ -705,6 +717,12 @@
         this(text, null, descrKey, kind, group, null, null, false);
     }
 
+    Option(String text, String descrKey,
+            OptionKind kind, OptionGroup group,
+            boolean doHasSuffix) {
+        this(text, null, descrKey, kind, group, null, null, doHasSuffix);
+    }
+
     Option(String text, String argsNameKey, String descrKey,
             OptionKind kind, OptionGroup group) {
         this(text, argsNameKey, descrKey, kind, group, null, null, false);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -403,13 +403,13 @@
         public SimpleConfiguration(Options options, Set<DiagnosticPart> parts) {
             this(parts);
             String showSource = null;
-            if ((showSource = options.get("showSource")) != null) {
+            if ((showSource = options.get("diags.showSource")) != null) {
                 if (showSource.equals("true"))
                     setVisiblePart(DiagnosticPart.SOURCE, true);
                 else if (showSource.equals("false"))
                     setVisiblePart(DiagnosticPart.SOURCE, false);
             }
-            String diagOpts = options.get("diags");
+            String diagOpts = options.get("diags.formatterOptions");
             if (diagOpts != null) {//override -XDshowSource
                 Collection<String> args = Arrays.asList(diagOpts.split(","));
                 if (args.contains("short")) {
@@ -422,7 +422,7 @@
                     setVisiblePart(DiagnosticPart.SOURCE, false);
             }
             String multiPolicy = null;
-            if ((multiPolicy = options.get("multilinePolicy")) != null) {
+            if ((multiPolicy = options.get("diags.multilinePolicy")) != null) {
                 if (multiPolicy.equals("disabled"))
                     setVisiblePart(DiagnosticPart.SUBDIAGNOSTICS, false);
                 else if (multiPolicy.startsWith("limit:")) {
@@ -447,7 +447,7 @@
                 }
             }
             String showCaret = null;
-            if (((showCaret = options.get("showCaret")) != null) &&
+            if (((showCaret = options.get("diags.showCaret")) != null) &&
                 showCaret.equals("false"))
                     setCaretEnabled(false);
             else
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -229,9 +229,9 @@
                             DiagnosticPart.SOURCE));
             initFormat();
             initIndentation();
-            if (options.isSet("oldDiags"))
+            if (options.isSet("diags.legacy"))
                 initOldFormat();
-            String fmt = options.get("diagsFormat");
+            String fmt = options.get("diags.layout");
             if (fmt != null) {
                 if (fmt.equals("OLD"))
                     initOldFormat();
@@ -239,12 +239,12 @@
                     initFormats(fmt);
             }
             String srcPos = null;
-            if ((((srcPos = options.get("sourcePosition")) != null)) &&
+            if ((((srcPos = options.get("diags.sourcePosition")) != null)) &&
                     srcPos.equals("bottom"))
                     setSourcePosition(SourcePosition.BOTTOM);
             else
                 setSourcePosition(SourcePosition.AFTER_SUMMARY);
-            String indent = options.get("diagsIndentation");
+            String indent = options.get("diags.indent");
             if (indent != null) {
                 String[] levels = indent.split("\\|");
                 try {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -644,7 +644,7 @@
                 EnumSet.of(RichFormatterFeature.SIMPLE_NAMES,
                     RichFormatterFeature.WHERE_CLAUSES,
                     RichFormatterFeature.UNIQUE_TYPEVAR_NAMES);
-            String diagOpts = options.get("diags");
+            String diagOpts = options.get("diags.formatterOptions");
             if (diagOpts != null) {
                 for (String args: diagOpts.split(",")) {
                     if (args.equals("-where")) {
--- a/langtools/test/tools/javac/Diagnostics/6722234/T6722234a.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234a.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,8 +3,8 @@
  * @bug     6722234
  * @summary javac diagnostics need better integration with the type-system
  * @author  mcimadamore
- * @compile/fail/ref=T6722234a_1.out -XDrawDiagnostics -XDdiags=disambiguateTvars T6722234a.java
- * @compile/fail/ref=T6722234a_2.out -XDrawDiagnostics -XDdiags=disambiguateTvars,where T6722234a.java
+ * @compile/fail/ref=T6722234a_1.out -XDrawDiagnostics -diags:formatterOptions=disambiguateTvars T6722234a.java
+ * @compile/fail/ref=T6722234a_2.out -XDrawDiagnostics -diags:formatterOptions=disambiguateTvars,where T6722234a.java
  */
 
 class T6722234a<T extends String> {
--- a/langtools/test/tools/javac/Diagnostics/6722234/T6722234b.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234b.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,8 +3,8 @@
  * @bug     6722234 8078024
  * @summary javac diagnostics need better integration with the type-system
  * @author  mcimadamore
- * @compile/fail/ref=T6722234b_1.out -XDrawDiagnostics -XDdiags=simpleNames T6722234b.java
- * @compile/fail/ref=T6722234b_2.out -XDrawDiagnostics -XDdiags=simpleNames,where T6722234b.java
+ * @compile/fail/ref=T6722234b_1.out -XDrawDiagnostics -diags:formatterOptions=simpleNames T6722234b.java
+ * @compile/fail/ref=T6722234b_2.out -XDrawDiagnostics -diags:formatterOptions=simpleNames,where T6722234b.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/Diagnostics/6722234/T6722234c.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234c.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,7 +3,7 @@
  * @bug     6722234
  * @summary javac diagnostics need better integration with the type-system
  * @author  mcimadamore
- * @compile/fail/ref=T6722234c.out -XDrawDiagnostics -XDdiags=simpleNames T6722234c.java
+ * @compile/fail/ref=T6722234c.out -XDrawDiagnostics -diags:formatterOptions=simpleNames T6722234c.java
  */
 
 class T6722234c {
--- a/langtools/test/tools/javac/Diagnostics/6722234/T6722234d.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234d.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,8 +3,8 @@
  * @bug     6722234 8078024
  * @summary javac diagnostics need better integration with the type-system
  * @author  mcimadamore
- * @compile/fail/ref=T6722234d_1.out -XDrawDiagnostics -XDdiags=where T6722234d.java
- * @compile/fail/ref=T6722234d_2.out -XDrawDiagnostics -XDdiags=where,simpleNames T6722234d.java
+ * @compile/fail/ref=T6722234d_1.out -XDrawDiagnostics -diags:formatterOptions=where T6722234d.java
+ * @compile/fail/ref=T6722234d_2.out -XDrawDiagnostics -diags:formatterOptions=where,simpleNames T6722234d.java
  */
 
 class T6722234d {
--- a/langtools/test/tools/javac/Diagnostics/6769027/T6769027.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/6769027/T6769027.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,8 +59,8 @@
 
     enum CaretKind {
         DEFAULT("", ""),
-        SHOW("showCaret","true"),
-        HIDE("showCaret","false");
+        SHOW("diags.showCaret","true"),
+        HIDE("diags.showCaret","false");
 
         String key;
         String value;
@@ -81,8 +81,8 @@
 
     enum SourceLineKind {
         DEFAULT("", ""),
-        AFTER_SUMMARY("sourcePosition", "top"),
-        BOTTOM("sourcePosition", "bottom");
+        AFTER_SUMMARY("diags.sourcePosition", "top"),
+        BOTTOM("diags.sourcePosition", "bottom");
 
         String key;
         String value;
@@ -110,9 +110,9 @@
 
         void init(Options opts) {
             if (this != DEFAULT) {
-                String flags = opts.get("diags");
+                String flags = opts.get("diags.formatterOptions");
                 flags = flags == null ? flag : flags + "," + flag;
-                opts.put("diags", flags);
+                opts.put("diags.formatterOptions", flags);
             }
         }
 
@@ -136,9 +136,9 @@
 
         void init(Options opts) {
             if (this != DEFAULT) {
-                String flags = opts.get("diags");
+                String flags = opts.get("diags.formatterOptions");
                 flags = flags == null ? flag : flags + "," + flag;
-                opts.put("diags", flags);
+                opts.put("diags.formatterOptions", flags);
             }
         }
 
@@ -243,11 +243,11 @@
     }
 
     enum MultilinePolicy {
-        ENABLED(0, "multilinePolicy", "enabled"),
-        DISABLED(1, "multilinePolicy", "disabled"),
-        LIMIT_LENGTH(2, "multilinePolicy", "limit:1:*"),
-        LIMIT_DEPTH(3, "multilinePolicy", "limit:*:1"),
-        LIMIT_BOTH(4, "multilinePolicy", "limit:1:1");
+        ENABLED(0, "diags.multilinePolicy", "enabled"),
+        DISABLED(1, "diags.multilinePolicy", "disabled"),
+        LIMIT_LENGTH(2, "diags.multilinePolicy", "limit:1:*"),
+        LIMIT_DEPTH(3, "diags.multilinePolicy", "limit:*:1"),
+        LIMIT_BOTH(4, "diags.multilinePolicy", "limit:1:1");
 
         String name;
         String value;
@@ -371,7 +371,7 @@
         indentString += (detailsIndent == IndentKind.CUSTOM) ? "|3" : "|0";
         indentString += (sourceIndent == IndentKind.CUSTOM) ? "|3" : "|0";
         indentString += (subdiagsIndent == IndentKind.CUSTOM) ? "|3" : "|0";
-        options.put("diagsIndentation", indentString);
+        options.put("diags.indent", indentString);
         MyLog log = new MyLog(ctx);
         JavacMessages messages = JavacMessages.instance(ctx);
         messages.add(locale -> ResourceBundle.getBundle("tester", locale));
--- a/langtools/test/tools/javac/Diagnostics/6862608/T6862608a.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/6862608/T6862608a.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,7 +3,7 @@
  * @bug     6862608
  * @summary rich diagnostic sometimes contain wrong type variable numbering
  * @author  mcimadamore
- * @compile/fail/ref=T6862608a.out -XDrawDiagnostics -XDdiags=disambiguateTvars,where T6862608a.java
+ * @compile/fail/ref=T6862608a.out -XDrawDiagnostics -diags:formatterOptions=disambiguateTvars,where T6862608a.java
  */
 
 
--- a/langtools/test/tools/javac/Diagnostics/6862608/T6862608b.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/6862608/T6862608b.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,7 +3,7 @@
  * @bug     6862608
  * @summary rich diagnostic sometimes contain wrong type variable numbering
  * @author  mcimadamore
- * @compile/fail/ref=T6862608b.out -XDrawDiagnostics -XDdiags=disambiguateTvars,where T6862608b.java
+ * @compile/fail/ref=T6862608b.out -XDrawDiagnostics -diags:formatterOptions=disambiguateTvars,where T6862608b.java
  */
 
 class T66862608b<T extends String, S> {
--- a/langtools/test/tools/javac/Diagnostics/7010608/Test.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/7010608/Test.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,9 +46,9 @@
         try {
             test(Arrays.<String>asList(),
                     "myfo://test:1: error: cannot find symbol");
-            test(Arrays.asList("-XDdiagsFormat=OLD"),
+            test(Arrays.asList("-diags:layout=OLD"),
                     "myfo://test:1: cannot find symbol");
-            test(Arrays.asList("-XDoldDiags"),
+            test(Arrays.asList("-diags:legacy"),
                     "myfo://test:1: cannot find symbol");
         } finally {
             Locale.setDefault(prev);
--- a/langtools/test/tools/javac/Diagnostics/8010387/T8010387.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/Diagnostics/8010387/T8010387.java	Tue Jul 26 07:45:29 2016 -0700
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug     8010387
  * @summary rich diagnostic sometimes contain wrong type variable numbering
- * @compile/fail/ref=T8010387.out -XDrawDiagnostics -XDdiags=disambiguateTvars,where T8010387.java
+ * @compile/fail/ref=T8010387.out -XDrawDiagnostics -diags:formatterOptions=disambiguateTvars,where T8010387.java
  */
 abstract class T8010387<X> {
 
--- a/langtools/test/tools/javac/InterfaceMemberClassModifiers.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/InterfaceMemberClassModifiers.java	Tue Jul 26 07:45:29 2016 -0700
@@ -4,7 +4,7 @@
  * @summary Verify that invalid access modifiers on interface members don't cause crash.
  * @author maddox
  *
- * @compile/fail/ref=InterfaceMemberClassModifiers.out -XDdiags=%b:%l:%_%m InterfaceMemberClassModifiers.java
+ * @compile/fail/ref=InterfaceMemberClassModifiers.out -diags:layout=%b:%l:%_%m InterfaceMemberClassModifiers.java
  */
 
 public interface InterfaceMemberClassModifiers {
--- a/langtools/test/tools/javac/T5003235/T5003235a.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/T5003235/T5003235a.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Private inner class accessible from subclasses
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235a.out -XDdiags=%b:%l:%_%m T5003235a.java
+ * @compile/fail/ref=T5003235a.out -diags:layout=%b:%l:%_%m T5003235a.java
  */
 
 class Super {
--- a/langtools/test/tools/javac/T5003235/T5003235b.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/T5003235/T5003235b.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Accessibility of private inner class
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235b.out -XDdiags=%b:%l:%_%m T5003235b.java
+ * @compile/fail/ref=T5003235b.out -diags:layout=%b:%l:%_%m T5003235b.java
  */
 
 class Outer {
--- a/langtools/test/tools/javac/T6214885.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/T6214885.java	Tue Jul 26 07:45:29 2016 -0700
@@ -2,8 +2,8 @@
  * @test  /nodynamiccopyright/
  * @bug 6214885
  * @summary This test exercises features provided by the new internal Diagnostics API
- * @compile/fail/ref=T6214885a.out -XDdiags=%b:%l%_%t%m|%p%m T6214885.java
- * @compile/fail/ref=T6214885b.out -XDdiags=%b:%l:%c%_%t%m|%p%m T6214885.java
+ * @compile/fail/ref=T6214885a.out -diags:layout=%b:%l%_%t%m|%p%m T6214885.java
+ * @compile/fail/ref=T6214885b.out -diags:layout=%b:%l:%c%_%t%m|%p%m T6214885.java
  */
 class T6214885
 {
--- a/langtools/test/tools/javac/api/6731573/T6731573.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/api/6731573/T6731573.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,8 +62,8 @@
 
     enum SourceLine {
         STANDARD(null),
-        ENABLED("-XDshowSource=true"),
-        DISABLED("-XDshowSource=false");
+        ENABLED("-diags:showSource=true"),
+        DISABLED("-diags:showSource=false");
 
         String optValue;
 
--- a/langtools/test/tools/javac/diags/CheckResourceKeys.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/CheckResourceKeys.java	Tue Jul 26 07:45:29 2016 -0700
@@ -263,6 +263,9 @@
                 // ignore shouldstop flag names
                 if (cs.startsWith("shouldstop."))
                     continue;
+                // ignore diagsformat flag names
+                if (cs.startsWith("diags."))
+                    continue;
                 // explicit known exceptions
                 if (noResourceRequired.contains(cs))
                     continue;
--- a/langtools/test/tools/javac/diags/examples/WhereCaptured.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/examples/WhereCaptured.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 // key: compiler.err.cant.apply.symbol
 // key: compiler.misc.incompatible.eq.bounds
 // key: compiler.misc.captured.type
-// options: -XDdiags=where,simpleNames
+// options: -diags:formatterOptions=where,simpleNames
 // run: simple
 
 import java.util.*;
--- a/langtools/test/tools/javac/diags/examples/WhereCaptured1.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/examples/WhereCaptured1.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 // key: compiler.misc.incompatible.eq.bounds
 // key: compiler.misc.captured.type
 // key: compiler.misc.type.null
-// options: -XDdiags=where,simpleNames
+// options: -diags:formatterOptions=where,simpleNames
 // run: simple
 
 import java.util.*;
--- a/langtools/test/tools/javac/diags/examples/WhereFreshTvar.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/examples/WhereFreshTvar.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 // key: compiler.misc.where.description.typevar
 // key: compiler.err.prob.found.req
 // key: compiler.misc.inconvertible.types
-// options: -XDdiags=where,simpleNames
+// options: -diags:formatterOptions=where,simpleNames
 // run: simple
 
 import java.util.*;
--- a/langtools/test/tools/javac/diags/examples/WhereIntersection.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/examples/WhereIntersection.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 // key: compiler.misc.where.description.intersection.1
 // key: compiler.misc.where.intersection
 // key: compiler.err.prob.found.req
-// options: -XDdiags=where
+// options: -diags:formatterOptions=where
 // run: simple
 
 class WhereIntersection {
--- a/langtools/test/tools/javac/diags/examples/WhereIntersection2.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/examples/WhereIntersection2.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 // key: compiler.misc.where.description.intersection
 // key: compiler.misc.where.intersection
 // key: compiler.err.prob.found.req
-// options: -XDdiags=where
+// options: -diags:formatterOptions=where
 // run: simple
 
 class WhereIntersection2 {
--- a/langtools/test/tools/javac/diags/examples/WhereTypeVar.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/examples/WhereTypeVar.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 // key: compiler.err.cant.apply.symbol
 // key: compiler.misc.no.conforming.assignment.exists
 // key: compiler.misc.inconvertible.types
-// options: -XDdiags=where,disambiguateTvars
+// options: -diags:formatterOptions=where,disambiguateTvars
 // run: simple
 
 class WhereTypeVar<T extends String> {
--- a/langtools/test/tools/javac/diags/examples/WhereTypeVar2.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/diags/examples/WhereTypeVar2.java	Tue Jul 26 07:45:29 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 // key: compiler.misc.where.description.typevar
 // key: compiler.misc.where.typevar
 // key: compiler.err.prob.found.req
-// options: -XDdiags=where
+// options: -diags:formatterOptions=where
 // run: simple
 
 class WhereTypeVar2 {
--- a/langtools/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.java	Tue Jul 26 07:45:29 2016 -0700
@@ -5,7 +5,7 @@
  * class is no longer available during a subsequent compilation.
  * @author maddox
  * @build impl
- * @compile/fail/ref=MissingSuperRecovery.out -XDdiags=%b:%l:%_%m MissingSuperRecovery.java
+ * @compile/fail/ref=MissingSuperRecovery.out -diags:layout=%b:%l:%_%m MissingSuperRecovery.java
  */
 
 // Requires "golden" class file 'impl.class', which contains
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess2.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess2.java	Tue Jul 26 07:45:29 2016 -0700
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess2.out -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess2.java
+ * @compile/fail/ref=ProtectedMemberAccess2.out -diags:formatterOptions=-simpleNames;layout=%b:%l:%_%m ProtectedMemberAccess2.java
  */
 
 // 71 errors expected.
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess3.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess3.java	Tue Jul 26 07:45:29 2016 -0700
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess3.out -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess3.java
+ * @compile/fail/ref=ProtectedMemberAccess3.out -diags:formatterOptions=-simpleNames;layout=%b:%l:%_%m ProtectedMemberAccess3.java
  */
 
 // 46 errors expected.
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess4.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess4.java	Tue Jul 26 07:45:29 2016 -0700
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess4.out -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess4.java
+ * @compile/fail/ref=ProtectedMemberAccess4.out -diags:formatterOptions=-simpleNames;layout=%b:%l:%_%m ProtectedMemberAccess4.java
  */
 
 // 33 errors expected.
--- a/langtools/test/tools/javac/unicode/UnicodeNewline.java	Tue Jul 26 15:52:51 2016 +0200
+++ b/langtools/test/tools/javac/unicode/UnicodeNewline.java	Tue Jul 26 07:45:29 2016 -0700
@@ -3,7 +3,7 @@
  * @bug 4739428 4785453
  * @summary when \u000a is used, diagnostics are reported on the wrong line.
  *
- * @compile/fail/ref=UnicodeNewline.out -XDdiags=%b:%l:%_%m UnicodeNewline.java
+ * @compile/fail/ref=UnicodeNewline.out -diags:layout=%b:%l:%_%m UnicodeNewline.java
  */
 
 class UnicodeNewline {