changeset 45504:ea7475564d07

8170326: Inconsistencies between code, compiler.properties and comments Summary: Converting uses of Log and JCDiagnostic.Factory methods to use CompilerProperties instead of plain Strings, fixing inconsistencies, adding crules analyzer to ensure CompilerProperties are used whenever possible. Reviewed-by: mcimadamore
author jlahoda
date Thu, 15 Jun 2017 13:44:42 +0200
parents d23ae2d67a5d
children ca0e16b2d5d6
files langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java langtools/make/tools/crules/LegacyLogMethodAnalyzer.java langtools/make/tools/crules/resources/crules.properties langtools/make/tools/propertiesparser/parser/MessageFile.java langtools/make/tools/propertiesparser/parser/MessageLine.java langtools/make/tools/propertiesparser/parser/MessageType.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ModuleFinder.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/CRTable.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java langtools/test/tools/javac/T5024091/T5024091.out langtools/test/tools/javac/annotations/neg/Cycle1.out langtools/test/tools/javac/annotations/neg/Cycle2.out langtools/test/tools/javac/annotations/neg/Cycle3.out langtools/test/tools/javac/annotations/neg/Dup.out langtools/test/tools/javac/annotations/neg/Z14.out langtools/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.out langtools/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.out langtools/test/tools/javac/annotations/repeatingAnnotations/DuplicateErrors.out langtools/test/tools/javac/annotations/repeatingAnnotations/NoRepeatableAnno.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/rest/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DuplicateTypeAnnotation.out langtools/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.out langtools/test/tools/javac/diags/examples.not-yet.txt langtools/test/tools/javac/importChecks/NoImportedNoClasses.out langtools/test/tools/javac/staticImport/ImportPrivate.out
diffstat 68 files changed, 821 insertions(+), 673 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java	Thu Jun 15 13:44:42 2017 +0200
@@ -67,7 +67,8 @@
         task.addTaskListener(new PostAnalyzeTaskListener(
                 new MutableFieldsAnalyzer(task),
                 new AssertCheckAnalyzer(task),
-                new DefinedByAnalyzer(task)
+                new DefinedByAnalyzer(task),
+                new LegacyLogMethodAnalyzer(task)
         ));
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/tools/crules/LegacyLogMethodAnalyzer.java	Thu Jun 15 13:44:42 2017 +0200
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2017, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package crules;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent.Kind;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
+import com.sun.tools.javac.tree.JCTree.Tag;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.AbstractLog;
+import com.sun.tools.javac.util.JCDiagnostic;
+
+/**This analyzer guards against legacy Log.error/warning/note methods that don't use the typed keys.*/
+public class LegacyLogMethodAnalyzer extends AbstractCodingRulesAnalyzer {
+
+    public LegacyLogMethodAnalyzer(JavacTask task) {
+        super(task);
+        treeVisitor = new LegacyLogMethodVisitor();
+        eventKind = Kind.ANALYZE;
+    }
+
+    private static final Set<String> LEGACY_METHOD_NAMES = new HashSet<>(
+            Arrays.asList("error", "mandatoryWarning", "warning", "mandatoryNote", "note", "fragment"));
+
+    class LegacyLogMethodVisitor extends TreeScanner {
+
+        @Override
+        public void visitClassDef(JCClassDecl tree) {
+            if (!tree.sym.packge().fullname.toString().startsWith("com.sun.tools.javac."))
+                return ;
+            super.visitClassDef(tree);
+        }
+
+        @Override
+        public void visitApply(JCMethodInvocation tree) {
+            checkLegacyLogMethod(tree);
+            super.visitApply(tree);
+        }
+
+        void checkLegacyLogMethod(JCMethodInvocation tree) {
+            Symbol method = TreeInfo.symbolFor(tree);
+            if (method == null ||
+                method.kind != Kinds.Kind.MTH ||
+                !typeToCheck(method.owner.type) ||
+                !LEGACY_METHOD_NAMES.contains(method.name.toString()) ||
+                !((MethodSymbol) method).isVarArgs() ||
+                method.type.getParameterTypes().size() < 2) {
+                return ;
+            }
+            JCExpression key = tree.args.get(method.type.getParameterTypes().size() - 2);
+            if (key.hasTag(Tag.LITERAL)) {
+                messages.error(tree, "crules.use.of.legacy.log.method", tree);
+            }
+        }
+
+        boolean typeToCheck(Type type) {
+            Symbol abstractLog = elements.getTypeElement(AbstractLog.class.getName());
+            Symbol diagnosticFactory = elements.getTypeElement(JCDiagnostic.Factory.class.getName().replace('$', '.'));
+            return types.isSubtype(type, abstractLog.type) ||
+                   types.isSubtype(type, diagnosticFactory.type);
+        }
+    }
+}
--- a/langtools/make/tools/crules/resources/crules.properties	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/make/tools/crules/resources/crules.properties	Thu Jun 15 13:44:42 2017 +0200
@@ -36,3 +36,5 @@
     This method implements a public API method, and is marked with incorrect @DefinedBy.
 crules.defined.by.no.api=\
     This method does not implement a public API method, and should not be marked with @DefinedBy.
+crules.use.of.legacy.log.method=\
+    Should not use legacy Log or JCDiagnostic.Factory methods when methods accepting an Error/Warning/Note/Fragment key can be used.
--- a/langtools/make/tools/propertiesparser/parser/MessageFile.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/make/tools/propertiesparser/parser/MessageFile.java	Thu Jun 15 13:44:42 2017 +0200
@@ -54,7 +54,7 @@
             if (line.startsWith(keyPrefix + ".")) {
                 int eq = line.indexOf("=");
                 if (eq > 0)
-                    messages.put(line.substring(0, eq), new Message(currLine));
+                    messages.put(line.substring(0, eq).trim(), new Message(currLine));
             }
         }
     }
--- a/langtools/make/tools/propertiesparser/parser/MessageLine.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/make/tools/propertiesparser/parser/MessageLine.java	Thu Jun 15 13:44:42 2017 +0200
@@ -32,7 +32,7 @@
 public class MessageLine {
 
     static final Pattern emptyOrCommentPattern = Pattern.compile("( *#.*)?");
-    static final Pattern typePattern = Pattern.compile("[-\\\\'A-Z\\.a-z ]+( \\([A-Za-z 0-9]+\\))?");
+    static final Pattern typePattern = Pattern.compile("[-\\\\'A-Z\\.a-z ]+( \\([-A-Za-z 0-9]+\\))?");
     static final Pattern infoPattern = Pattern.compile(String.format("# ([0-9]+: %s, )*[0-9]+: %s",
             typePattern.pattern(), typePattern.pattern()));
 
--- a/langtools/make/tools/propertiesparser/parser/MessageType.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/make/tools/propertiesparser/parser/MessageType.java	Thu Jun 15 13:44:42 2017 +0200
@@ -71,7 +71,10 @@
      */
     public enum SimpleType implements MessageType {
 
+        ANNOTATION("annotation", "Compound", "com.sun.tools.javac.code.Attribute"),
         BOOLEAN("boolean", "boolean", null),
+        COLLECTION("collection", "Collection", "java.util"),
+        FLAG("flag", "Flag", "com.sun.tools.javac.code.Flags"),
         FRAGMENT("fragment", "Fragment", null),
         DIAGNOSTIC("diagnostic", "JCDiagnostic", "com.sun.tools.javac.util"),
         MODIFIER("modifier", "Modifier", "javax.lang.model.element"),
@@ -81,7 +84,7 @@
         NAME("name", "Name", "com.sun.tools.javac.util"),
         NUMBER("number", "int", null),
         OPTION_NAME("option name", "Option", "com.sun.tools.javac.main"),
-        SOURCE_VERSION("source version", "Source", "com.sun.tools.javac.code"),
+        SOURCE_VERSION("source version", "SourceVersion", "javax.lang.model"),
         STRING("string", "String", null),
         SYMBOL("symbol", "Symbol", "com.sun.tools.javac.code"),
         SYMBOL_KIND("symbol kind", "Kind", "com.sun.tools.javac.code.Kinds"),
@@ -131,6 +134,7 @@
          * Compound type kind.
          */
         public enum Kind {
+            COLLECTION("collection of", SimpleType.COLLECTION),
             LIST("list of", SimpleType.LIST),
             SET("set of", SimpleType.SET);
 
@@ -180,7 +184,7 @@
          */
         public enum Kind {
             MESSAGE_SEGMENT("message segment", SimpleType.DIAGNOSTIC, SimpleType.FRAGMENT),
-            FILE_NAME("file name", SimpleType.FILE, SimpleType.FILE_OBJECT);
+            FILE_NAME("file name", SimpleType.FILE, SimpleType.FILE_OBJECT, SimpleType.PATH);
 
             final String kindName;
             final SimpleType[] choices;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Thu Jun 15 13:44:42 2017 +0200
@@ -52,6 +52,7 @@
 import com.sun.tools.javac.platform.PlatformDescription;
 import com.sun.tools.javac.platform.PlatformDescription.PluginInfo;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
@@ -219,7 +220,7 @@
             }
         }
         for (List<String> p: pluginsToCall) {
-            Log.instance(context).error("plugin.not.found", p.head);
+            Log.instance(context).error(Errors.PluginNotFound(p.head));
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Thu Jun 15 13:44:42 2017 +0200
@@ -102,6 +102,9 @@
 import com.sun.tools.javac.parser.Tokens.Comment;
 import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Notes;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.DCTree;
 import com.sun.tools.javac.tree.DCTree.DCBlockTag;
 import com.sun.tools.javac.tree.DCTree.DCDocComment;
@@ -1129,19 +1132,19 @@
         try {
             switch (kind) {
             case ERROR:
-                log.error(DiagnosticFlag.MULTIPLE, pos, "proc.messager", msg.toString());
+                log.error(DiagnosticFlag.MULTIPLE, pos, Errors.ProcMessager(msg.toString()));
                 break;
 
             case WARNING:
-                log.warning(pos, "proc.messager", msg.toString());
+                log.warning(pos, Warnings.ProcMessager(msg.toString()));
                 break;
 
             case MANDATORY_WARNING:
-                log.mandatoryWarning(pos, "proc.messager", msg.toString());
+                log.mandatoryWarning(pos, Warnings.ProcMessager(msg.toString()));
                 break;
 
             default:
-                log.note(pos, "proc.messager", msg.toString());
+                log.note(pos, Notes.ProcMessager(msg.toString()));
             }
         } finally {
             if (oldSource != null)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Thu Jun 15 13:44:42 2017 +0200
@@ -56,6 +56,7 @@
 import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.platform.PlatformDescription;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import com.sun.tools.javac.util.*;
 
 import static javax.tools.StandardLocation.*;
@@ -292,7 +293,9 @@
             try {
                 fillIn(p);
             } catch (IOException ex) {
-                throw new CompletionFailure(sym, ex.getLocalizedMessage()).initCause(ex);
+                JCDiagnostic msg =
+                        diagFactory.fragment(Fragments.ExceptionMessage(ex.getLocalizedMessage()));
+                throw new CompletionFailure(sym, msg).initCause(ex);
             }
         }
         if (!reader.filling)
@@ -329,7 +332,9 @@
      */
     void fillIn(ClassSymbol c) {
         if (completionFailureName == c.fullname) {
-            throw new CompletionFailure(c, "user-selected completion failure by class name");
+            JCDiagnostic msg =
+                    diagFactory.fragment(Fragments.UserSelectedCompletionFailure);
+            throw new CompletionFailure(c, msg);
         }
         currentOwner = c;
         JavaFileObject classfile = c.classfile;
@@ -365,7 +370,7 @@
     // where
         private CompletionFailure classFileNotFound(ClassSymbol c) {
             JCDiagnostic diag =
-                diagFactory.fragment("class.file.not.found", c.flatname);
+                diagFactory.fragment(Fragments.ClassFileNotFound(c.flatname));
             return newCompletionFailure(c, diag);
         }
         /** Static factory for CompletionFailure objects.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ModuleFinder.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ModuleFinder.java	Thu Jun 15 13:44:42 2017 +0200
@@ -225,7 +225,7 @@
                 name = moduleNameFromSourceReader.readModuleName(fo);
                 if (name == null) {
                     JCDiagnostic diag =
-                        diags.fragment("file.does.not.contain.module");
+                        diags.fragment(Fragments.FileDoesNotContainModule);
                     ClassSymbol errModuleInfo = syms.defineClass(names.module_info, syms.errModule);
                     throw new ClassFinder.BadClassFile(errModuleInfo, fo, diag, diags);
                 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Jun 15 13:44:42 2017 +0200
@@ -2148,18 +2148,6 @@
          */
         public JCDiagnostic diag;
 
-        /** A localized string describing the failure.
-         * @deprecated Use {@code getDetail()} or {@code getMessage()}
-         */
-        @Deprecated
-        public String errmsg;
-
-        public CompletionFailure(Symbol sym, String errmsg) {
-            this.sym = sym;
-            this.errmsg = errmsg;
-//          this.printStackTrace();//DEBUG
-        }
-
         public CompletionFailure(Symbol sym, JCDiagnostic diag) {
             this.sym = sym;
             this.diag = diag;
@@ -2172,14 +2160,11 @@
 
         @Override
         public String getMessage() {
-            if (diag != null)
-                return diag.getMessage(null);
-            else
-                return errmsg;
+            return diag.getMessage(null);
         }
 
-        public Object getDetailValue() {
-            return (diag != null ? diag : errmsg);
+        public JCDiagnostic getDetailValue() {
+            return diag;
         }
 
         @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Jun 15 13:44:42 2017 +0200
@@ -55,6 +55,7 @@
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.tree.JCTree.JCBlock;
@@ -480,12 +481,12 @@
                             // The normal declaration annotation checks make sure that the use is valid.
                             break;
                         case 1:
-                            log.error(typetree.pos(), "cant.type.annotate.scoping.1",
-                                    onlyTypeAnnotations);
+                            log.error(typetree.pos(),
+                                      Errors.CantTypeAnnotateScoping1(onlyTypeAnnotations.head));
                             break;
                         default:
-                            log.error(typetree.pos(), "cant.type.annotate.scoping",
-                                    onlyTypeAnnotations);
+                            log.error(typetree.pos(),
+                                      Errors.CantTypeAnnotateScoping(onlyTypeAnnotations));
                     }
                     return type;
                 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jun 15 13:44:42 2017 +0200
@@ -58,6 +58,7 @@
 import static com.sun.tools.javac.code.Type.*;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.jvm.ClassFile.externalize;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 
 /**
  * Utility class containing various operations on types.
@@ -374,7 +375,7 @@
                 if (!chk.checkValidGenericType(site)) {
                     //if the inferred functional interface type is not well-formed,
                     //or if it's not a subtype of the original target, issue an error
-                    throw failure(diags.fragment("no.suitable.functional.intf.inst", site));
+                    throw failure(diags.fragment(Fragments.NoSuitableFunctionalIntfInst(site)));
                 }
                 return memberType(site, descSym);
             }
@@ -434,13 +435,13 @@
                 } else {
                     //the target method(s) should be the only abstract members of t
                     throw failure("not.a.functional.intf.1",  origin,
-                            diags.fragment("incompatible.abstracts", Kinds.kindName(origin), origin));
+                            diags.fragment(Fragments.IncompatibleAbstracts(Kinds.kindName(origin), origin)));
                 }
             }
             if (abstracts.isEmpty()) {
                 //t must define a suitable non-generic method
                 throw failure("not.a.functional.intf.1", origin,
-                            diags.fragment("no.abstracts", Kinds.kindName(origin), origin));
+                            diags.fragment(Fragments.NoAbstracts(Kinds.kindName(origin), origin)));
             } else if (abstracts.size() == 1) {
                 return new FunctionDescriptor(abstracts.first());
             } else { // size > 1
@@ -456,9 +457,11 @@
                                 desc.type.getReturnType(),
                                 desc.type.getThrownTypes()));
                     }
+                    JCDiagnostic msg =
+                            diags.fragment(Fragments.IncompatibleDescsInFunctionalIntf(Kinds.kindName(origin),
+                                                                                       origin));
                     JCDiagnostic.MultilineDiagnostic incompatibleDescriptors =
-                            new JCDiagnostic.MultilineDiagnostic(diags.fragment("incompatible.descs.in.functional.intf",
-                            Kinds.kindName(origin), origin), descriptors.toList());
+                            new JCDiagnostic.MultilineDiagnostic(msg, descriptors.toList());
                     throw failure(incompatibleDescriptors);
                 }
                 return descRes;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Thu Jun 15 13:44:42 2017 +0200
@@ -30,6 +30,7 @@
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Types;
 import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCBlock;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -246,7 +247,7 @@
                     explicitArgs = explicitArgs.tail;
                 }
                 //exact match
-                log.warning(oldTree.clazz, "diamond.redundant.args");
+                log.warning(oldTree.clazz, Warnings.DiamondRedundantArgs);
             }
         }
     }
@@ -294,7 +295,7 @@
         @Override
         void process (JCNewClass oldTree, JCLambda newTree, boolean hasErrors){
             if (!hasErrors) {
-                log.warning(oldTree.def, "potential.lambda.found");
+                log.warning(oldTree.def, Warnings.PotentialLambdaFound);
             }
         }
     }
@@ -322,7 +323,7 @@
         void process (JCMethodInvocation oldTree, JCMethodInvocation newTree, boolean hasErrors){
             if (!hasErrors) {
                 //exact match
-                log.warning(oldTree, "method.redundant.typeargs");
+                log.warning(oldTree, Warnings.MethodRedundantTypeargs);
             }
         }
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Jun 15 13:44:42 2017 +0200
@@ -254,7 +254,7 @@
             Lint prevLint = deferPos != null ? null : chk.setLint(lint);
             try {
                 if (s.hasAnnotations() && annotations.nonEmpty())
-                    log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s);
+                    log.error(annotations.head.pos, Errors.AlreadyAnnotated(Kinds.kindName(s), s));
 
                 Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null");
 
@@ -342,7 +342,7 @@
 
             if (annotated.containsKey(a.type.tsym)) {
                 if (!allowRepeatedAnnos) {
-                    log.error(DiagnosticFlag.SOURCE_LEVEL, a.pos(), "repeatable.annotations.not.supported.in.source", sourceName);
+                    log.error(DiagnosticFlag.SOURCE_LEVEL, a.pos(), Errors.RepeatableAnnotationsNotSupportedInSource(sourceName));
                 }
                 ListBuffer<T> l = annotated.get(a.type.tsym);
                 l = l.append(c);
@@ -456,8 +456,7 @@
 
         boolean isError = a.type.isErroneous();
         if (!a.type.tsym.isAnnotationType() && !isError) {
-            log.error(a.annotationType.pos(),
-                    "not.annotation.type", a.type.toString());
+            log.error(a.annotationType.pos(), Errors.NotAnnotationType(a.type));
             isError = true;
         }
 
@@ -486,13 +485,13 @@
             Type thisAnnotationType, boolean badAnnotation, Env<AttrContext> env, boolean elidedValue)
     {
         if (!nameValuePair.hasTag(ASSIGN)) {
-            log.error(nameValuePair.pos(), "annotation.value.must.be.name.value");
+            log.error(nameValuePair.pos(), Errors.AnnotationValueMustBeNameValue);
             attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env);
             return null;
         }
         JCAssign assign = (JCAssign)nameValuePair;
         if (!assign.lhs.hasTag(IDENT)) {
-            log.error(nameValuePair.pos(), "annotation.value.must.be.name.value");
+            log.error(nameValuePair.pos(), Errors.AnnotationValueMustBeNameValue);
             attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env);
             return null;
         }
@@ -505,7 +504,7 @@
         left.sym = method;
         left.type = method.type;
         if (method.owner != thisAnnotationType.tsym && !badAnnotation)
-            log.error(left.pos(), "no.annotation.member", left.name, thisAnnotationType);
+            log.error(left.pos(), Errors.NoAnnotationMember(left.name, thisAnnotationType));
         Type resultType = method.type.getReturnType();
 
         // Compute value part
@@ -526,7 +525,7 @@
         try {
             expectedElementType.tsym.complete();
         } catch(CompletionFailure e) {
-            log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym);
+            log.error(tree.pos(), Errors.CantResolve(Kinds.kindName(e.sym), e.sym.getQualifiedName(), null, null));
             expectedElementType = syms.errType;
         }
 
@@ -538,10 +537,10 @@
         //error recovery
         if (tree.hasTag(NEWARRAY)) {
             if (!expectedElementType.isErroneous())
-                log.error(tree.pos(), "annotation.value.not.allowable.type");
+                log.error(tree.pos(), Errors.AnnotationValueNotAllowableType);
             JCNewArray na = (JCNewArray)tree;
             if (na.elemtype != null) {
-                log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
+                log.error(na.elemtype.pos(), Errors.NewNotAllowedInAnnotation);
             }
             for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
                 attributeAnnotationValue(syms.errType,
@@ -555,7 +554,7 @@
             if (tree.hasTag(ANNOTATION)) {
                 return attributeAnnotation((JCAnnotation)tree, expectedElementType, env);
             } else {
-                log.error(tree.pos(), "annotation.value.must.be.annotation");
+                log.error(tree.pos(), Errors.AnnotationValueMustBeAnnotation);
                 expectedElementType = syms.errType;
             }
         }
@@ -563,7 +562,7 @@
         //error recovery
         if (tree.hasTag(ANNOTATION)) {
             if (!expectedElementType.isErroneous())
-                log.error(tree.pos(), "annotation.not.valid.for.type", expectedElementType);
+                log.error(tree.pos(), Errors.AnnotationNotValidForType(expectedElementType));
             attributeAnnotation((JCAnnotation)tree, syms.errType, env);
             return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
         }
@@ -598,7 +597,7 @@
 
         //error recovery:
         if (!expectedElementType.isErroneous())
-            log.error(tree.pos(), "annotation.value.not.allowable.type");
+            log.error(tree.pos(), Errors.AnnotationValueNotAllowableType);
         return new Attribute.Error(attr.attribExpr(tree, env, expectedElementType));
     }
 
@@ -609,7 +608,7 @@
                 TreeInfo.nonstaticSelect(tree) ||
                 sym.kind != VAR ||
                 (sym.flags() & Flags.ENUM) == 0) {
-            log.error(tree.pos(), "enum.annotation.must.be.enum.constant");
+            log.error(tree.pos(), Errors.EnumAnnotationMustBeEnumConstant);
             return new Attribute.Error(result.getOriginalType());
         }
         VarSymbol enumerator = (VarSymbol) sym;
@@ -640,7 +639,7 @@
         if (result.isErroneous())
             return new Attribute.Error(result.getOriginalType());
         if (result.constValue() == null) {
-            log.error(tree.pos(), "attribute.value.must.be.constant");
+            log.error(tree.pos(), Errors.AttributeValueMustBeConstant);
             return new Attribute.Error(expectedElementType);
         }
         result = cfolder.coerce(result, expectedElementType);
@@ -656,7 +655,7 @@
 
         JCNewArray na = (JCNewArray)tree;
         if (na.elemtype != null) {
-            log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
+            log.error(na.elemtype.pos(), Errors.NewNotAllowedInAnnotation);
         }
         ListBuffer<Attribute> buf = new ListBuffer<>();
         for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
@@ -751,7 +750,7 @@
         }
 
         if (!repeated.isEmpty() && targetContainerType == null) {
-            log.error(ctx.pos.get(annotations.head), "duplicate.annotation.invalid.repeated", origAnnoType);
+            log.error(ctx.pos.get(annotations.head), Errors.DuplicateAnnotationInvalidRepeated(origAnnoType));
             return null;
         }
 
@@ -798,7 +797,7 @@
                 }
 
                 if (!chk.validateAnnotationDeferErrors(annoTree))
-                    log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
+                    log.error(annoTree.pos(), Errors.DuplicateAnnotationInvalidRepeated(origAnnoType));
 
                 c = attributeAnnotation(annoTree, targetContainerType, ctx.env);
                 c.setSynthesized(true);
@@ -827,7 +826,7 @@
         Attribute.Compound ca = origAnnoDecl.getAnnotationTypeMetadata().getRepeatable();
         if (ca == null) { // has no Repeatable annotation
             if (reportError)
-                log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.repeatableType);
+                log.error(pos, Errors.DuplicateAnnotationMissingContainer(origAnnoType));
             return null;
         }
 
@@ -855,17 +854,17 @@
 
         // Repeatable must have at least one element
         if (ca.values.isEmpty()) {
-            log.error(pos, "invalid.repeatable.annotation", annoDecl);
+            log.error(pos, Errors.InvalidRepeatableAnnotation(annoDecl));
             return null;
         }
         Pair<MethodSymbol,Attribute> p = ca.values.head;
         Name name = p.fst.name;
         if (name != names.value) { // should contain only one element, named "value"
-            log.error(pos, "invalid.repeatable.annotation", annoDecl);
+            log.error(pos, Errors.InvalidRepeatableAnnotation(annoDecl));
             return null;
         }
         if (!(p.snd instanceof Attribute.Class)) { // check that the value of "value" is an Attribute.Class
-            log.error(pos, "invalid.repeatable.annotation", annoDecl);
+            log.error(pos, Errors.InvalidRepeatableAnnotation(annoDecl));
             return null;
         }
 
@@ -900,14 +899,12 @@
         }
         if (error) {
             log.error(pos,
-                    "invalid.repeatable.annotation.multiple.values",
-                    targetContainerType,
-                    nr_value_elems);
+                      Errors.InvalidRepeatableAnnotationMultipleValues(targetContainerType,
+                                                                       nr_value_elems));
             return null;
         } else if (nr_value_elems == 0) {
             log.error(pos,
-                    "invalid.repeatable.annotation.no.value",
-                    targetContainerType);
+                      Errors.InvalidRepeatableAnnotationNoValue(targetContainerType));
             return null;
         }
 
@@ -915,8 +912,7 @@
         // probably "impossible" to fail this
         if (containerValueSymbol.kind != MTH) {
             log.error(pos,
-                    "invalid.repeatable.annotation.invalid.value",
-                    targetContainerType);
+                    Errors.InvalidRepeatableAnnotationInvalidValue(targetContainerType));
             fatalError = true;
         }
 
@@ -927,10 +923,9 @@
         if (!(types.isArray(valueRetType) &&
                 types.isSameType(expectedType, valueRetType))) {
             log.error(pos,
-                    "invalid.repeatable.annotation.value.return",
-                    targetContainerType,
-                    valueRetType,
-                    expectedType);
+                      Errors.InvalidRepeatableAnnotationValueReturn(targetContainerType,
+                                                                    valueRetType,
+                                                                    expectedType));
             fatalError = true;
         }
 
@@ -951,8 +946,7 @@
             ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
             if (manualContainer != null) {
                 log.error(ctx.pos.get(manualContainer.first()),
-                        "invalid.repeatable.annotation.repeated.and.container.present",
-                        manualContainer.first().type.tsym);
+                          Errors.InvalidRepeatableAnnotationRepeatedAndContainerPresent(manualContainer.first().type.tsym));
             }
         }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Thu Jun 15 13:44:42 2017 +0200
@@ -41,6 +41,7 @@
 import com.sun.tools.javac.comp.DeferredAttr.LambdaReturnScanner;
 import com.sun.tools.javac.comp.Infer.PartiallyInferredMethodType;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCConditional;
 import com.sun.tools.javac.tree.JCTree.JCExpression;
@@ -433,7 +434,7 @@
                 return localInfo.check(speculativeTree, speculativeTree.type);
             } else if (resultInfo.pt.hasTag(VOID)) {
                 //this means we are returning a poly conditional from void-compatible lambda expression
-                resultInfo.checkContext.report(tree, attr.diags.fragment("conditional.target.cant.be.void"));
+                resultInfo.checkContext.report(tree, attr.diags.fragment(Fragments.ConditionalTargetCantBeVoid));
                 return attr.types.createErrorType(resultInfo.pt);
             } else {
                 //poly
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 15 13:44:42 2017 +0200
@@ -53,6 +53,7 @@
 import static com.sun.tools.javac.resources.CompilerProperties.Fragments.DiamondInvalidArgs;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.resources.CompilerProperties.Fragments;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
@@ -227,9 +228,9 @@
                 !resultInfo.pt.hasTag(METHOD) &&
                 !resultInfo.pt.hasTag(FORALL);
         if (shouldCheck && !ownkind.subset(resultInfo.pkind)) {
-            log.error(tree.pos(), "unexpected.type",
-            resultInfo.pkind.kindNames(),
-            ownkind.kindNames());
+            log.error(tree.pos(),
+                      Errors.UnexpectedType(resultInfo.pkind.kindNames(),
+                                            ownkind.kindNames()));
             owntype = types.createErrorType(found);
         } else if (allowPoly && inferenceContext.free(found)) {
             //delay the check if there are inference variables in the found type
@@ -292,9 +293,9 @@
                (base.hasTag(IDENT) && TreeInfo.name(base) == names._this)) &&
                isAssignableAsBlankFinal(v, env)))) {
             if (v.isResourceVariable()) { //TWR resource
-                log.error(pos, "try.resource.may.not.be.assigned", v);
+                log.error(pos, Errors.TryResourceMayNotBeAssigned(v));
             } else {
-                log.error(pos, "cant.assign.val.to.final.var", v);
+                log.error(pos, Errors.CantAssignValToFinalVar(v));
             }
         }
     }
@@ -868,7 +869,7 @@
         final DiagnosticPosition pos = tree.hasTag(TYPEAPPLY) ?
                 (((JCTypeApply) tree).clazz).pos() : tree.pos();
         if (t.tsym.isAnonymous()) {
-            log.error(pos, "cant.inherit.from.anon");
+            log.error(pos, Errors.CantInheritFromAnon);
             return types.createErrorType(t);
         }
         if (t.isErroneous())
@@ -876,27 +877,27 @@
         if (t.hasTag(TYPEVAR) && !classExpected && !interfaceExpected) {
             // check that type variable is already visible
             if (t.getUpperBound() == null) {
-                log.error(pos, "illegal.forward.ref");
+                log.error(pos, Errors.IllegalForwardRef);
                 return types.createErrorType(t);
             }
         } else {
             t = chk.checkClassType(pos, t, checkExtensible);
         }
         if (interfaceExpected && (t.tsym.flags() & INTERFACE) == 0) {
-            log.error(pos, "intf.expected.here");
+            log.error(pos, Errors.IntfExpectedHere);
             // return errType is necessary since otherwise there might
             // be undetected cycles which cause attribution to loop
             return types.createErrorType(t);
         } else if (checkExtensible &&
                    classExpected &&
                    (t.tsym.flags() & INTERFACE) != 0) {
-            log.error(pos, "no.intf.expected.here");
+            log.error(pos, Errors.NoIntfExpectedHere);
             return types.createErrorType(t);
         }
         if (checkExtensible &&
             ((t.tsym.flags() & FINAL) != 0)) {
             log.error(pos,
-                      "cant.inherit.from.final", t.tsym);
+                      Errors.CantInheritFromFinal(t.tsym));
         }
         chk.checkNonCyclic(pos, t);
         return t;
@@ -980,7 +981,7 @@
             chk.checkOverride(env, tree, m);
 
             if (isDefaultMethod && types.overridesObjectMethod(m.enclClass(), m)) {
-                log.error(tree, "default.overrides.object.member", m.name, Kinds.kindName(m.location()), m.location());
+                log.error(tree, Errors.DefaultOverridesObjectMember(m.name, Kinds.kindName(m.location()), m.location()));
             }
 
             // Enter all type parameters into the local method scope.
@@ -994,7 +995,7 @@
                 log.error(tree.params.nonEmpty() ?
                         tree.params.head.pos() :
                         tree.recvparam.pos(),
-                        "intf.annotation.members.cant.have.params");
+                        Errors.IntfAnnotationMembersCantHaveParams);
 
             // Attribute all value parameters.
             for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
@@ -1025,12 +1026,12 @@
                 // annotation method cannot have throws clause
                 if (tree.thrown.nonEmpty()) {
                     log.error(tree.thrown.head.pos(),
-                            "throws.not.allowed.in.intf.annotation");
+                              Errors.ThrowsNotAllowedInIntfAnnotation);
                 }
                 // annotation method cannot declare type-parameters
                 if (tree.typarams.nonEmpty()) {
                     log.error(tree.typarams.head.pos(),
-                            "intf.annotation.members.cant.have.type.params");
+                              Errors.IntfAnnotationMembersCantHaveTypeParams);
                 }
                 // validate annotation method's return type (could be an annotation type)
                 chk.validateAnnotationType(tree.restype);
@@ -1048,18 +1049,18 @@
                 if (tree.defaultValue != null) {
                     if ((owner.flags() & ANNOTATION) == 0)
                         log.error(tree.pos(),
-                                  "default.allowed.in.intf.annotation.member");
+                                  Errors.DefaultAllowedInIntfAnnotationMember);
                 }
                 if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0)
-                    log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
+                    log.error(tree.pos(), Errors.MissingMethBodyOrDeclAbstract);
             } else if ((tree.sym.flags() & (ABSTRACT|DEFAULT|PRIVATE)) == ABSTRACT) {
                 if ((owner.flags() & INTERFACE) != 0) {
-                    log.error(tree.body.pos(), "intf.meth.cant.have.body");
+                    log.error(tree.body.pos(), Errors.IntfMethCantHaveBody);
                 } else {
-                    log.error(tree.pos(), "abstract.meth.cant.have.body");
+                    log.error(tree.pos(), Errors.AbstractMethCantHaveBody);
                 }
             } else if ((tree.mods.flags & NATIVE) != 0) {
-                log.error(tree.pos(), "native.meth.cant.have.body");
+                log.error(tree.pos(), Errors.NativeMethCantHaveBody);
             } else {
                 // Add an implicit super() call unless an explicit call to
                 // super(...) or this(...) is given
@@ -1081,8 +1082,7 @@
                         // in enum constructors, except in the compiler
                         // generated one.
                         log.error(tree.body.stats.head.pos(),
-                                "call.to.super.not.allowed.in.enum.ctor",
-                                env.enclClass.sym);
+                                  Errors.CallToSuperNotAllowedInEnumCtor(env.enclClass.sym));
                     }
                 }
 
@@ -1252,9 +1252,8 @@
                 Type base = types.asSuper(exprType, syms.iterableType.tsym);
                 if (base == null) {
                     log.error(tree.expr.pos(),
-                            "foreach.not.applicable.to.type",
-                            exprType,
-                            diags.fragment("type.req.array.or.iterable"));
+                              Errors.ForeachNotApplicableToType(exprType,
+                                                                Fragments.TypeReqArrayOrIterable));
                     elemtype = types.createErrorType(exprType);
                 } else {
                     List<Type> iterableParams = base.allparams();
@@ -1279,8 +1278,8 @@
         while (env1 != null && !env1.tree.hasTag(CLASSDEF)) {
             if (env1.tree.hasTag(LABELLED) &&
                 ((JCLabeledStatement) env1.tree).label == tree.label) {
-                log.error(tree.pos(), "label.already.in.use",
-                          tree.label);
+                log.error(tree.pos(),
+                          Errors.LabelAlreadyInUse(tree.label));
                 break;
             }
             env1 = env1.next;
@@ -1301,7 +1300,7 @@
             boolean enumSwitch = (seltype.tsym.flags() & Flags.ENUM) != 0;
             boolean stringSwitch = types.isSameType(seltype, syms.stringType);
             if (stringSwitch && !allowStringsInSwitch) {
-                log.error(DiagnosticFlag.SOURCE_LEVEL, tree.selector.pos(), "string.switch.not.supported.in.source", sourceName);
+                log.error(DiagnosticFlag.SOURCE_LEVEL, tree.selector.pos(), Errors.StringSwitchNotSupportedInSource(sourceName));
             }
             if (!enumSwitch && !stringSwitch)
                 seltype = chk.checkType(tree.selector.pos(), seltype, syms.intType);
@@ -1316,9 +1315,9 @@
                     if (enumSwitch) {
                         Symbol sym = enumConstant(c.pat, seltype);
                         if (sym == null) {
-                            log.error(c.pat.pos(), "enum.label.must.be.unqualified.enum");
+                            log.error(c.pat.pos(), Errors.EnumLabelMustBeUnqualifiedEnum);
                         } else if (!labels.add(sym)) {
-                            log.error(c.pos(), "duplicate.case.label");
+                            log.error(c.pos(), Errors.DuplicateCaseLabel);
                         }
                     } else {
                         Type pattype = attribExpr(c.pat, switchEnv, seltype);
@@ -1327,12 +1326,12 @@
                                 log.error(c.pat.pos(),
                                           (stringSwitch ? "string.const.req" : "const.expr.req"));
                             } else if (!labels.add(pattype.constValue())) {
-                                log.error(c.pos(), "duplicate.case.label");
+                                log.error(c.pos(), Errors.DuplicateCaseLabel);
                             }
                         }
                     }
                 } else if (hasDefault) {
-                    log.error(c.pos(), "duplicate.default.label");
+                    log.error(c.pos(), Errors.DuplicateDefaultLabel);
                 } else {
                     hasDefault = true;
                 }
@@ -1401,7 +1400,7 @@
                     CheckContext twrContext = new Check.NestedCheckContext(resultInfo.checkContext) {
                         @Override
                         public void report(DiagnosticPosition pos, JCDiagnostic details) {
-                            chk.basicHandler.report(pos, diags.fragment("try.not.applicable.to.type", details));
+                            chk.basicHandler.report(pos, diags.fragment(Fragments.TryNotApplicableToType(details)));
                         }
                     };
                     ResultInfo twrResult =
@@ -1481,7 +1480,7 @@
                     close.overrides(syms.autoCloseableClose, resource.tsym, types, true) &&
                     chk.isHandled(syms.interruptedExceptionType, types.memberType(resource, close).getThrownTypes()) &&
                     env.info.lint.isEnabled(LintCategory.TRY)) {
-                log.warning(LintCategory.TRY, pos, "try.resource.throws.interrupted.exc", resource);
+                log.warning(LintCategory.TRY, pos, Warnings.TryResourceThrowsInterruptedExc(resource));
             }
         }
     }
@@ -1496,7 +1495,7 @@
 
         if (tree.polyKind == PolyKind.POLY && resultInfo.pt.hasTag(VOID)) {
             //this means we are returning a poly conditional from void-compatible lambda expression
-            resultInfo.checkContext.report(tree, diags.fragment("conditional.target.cant.be.void"));
+            resultInfo.checkContext.report(tree, diags.fragment(Fragments.ConditionalTargetCantBeVoid));
             result = tree.type = types.createErrorType(resultInfo.pt);
             return;
         }
@@ -1574,7 +1573,7 @@
                 //depending on whether boxing is allowed, we could have incompatibilities
                 @Override
                 public void report(DiagnosticPosition pos, JCDiagnostic details) {
-                    enclosingContext.report(pos, diags.fragment("incompatible.type.in.conditional", details));
+                    enclosingContext.report(pos, diags.fragment(Fragments.IncompatibleTypeInConditional(details)));
                 }
             };
         }
@@ -1640,8 +1639,9 @@
                 return thentype.baseType();
 
             if (thentype.hasTag(VOID) || elsetype.hasTag(VOID)) {
-                log.error(pos, "neither.conditional.subtype",
-                          thentype, elsetype);
+                log.error(pos,
+                          Errors.NeitherConditionalSubtype(thentype,
+                                                           elsetype));
                 return thentype.baseType();
             }
 
@@ -1720,7 +1720,7 @@
                                         !labelled.body.hasTag(WHILELOOP) &&
                                         !labelled.body.hasTag(FORLOOP) &&
                                         !labelled.body.hasTag(FOREACHLOOP))
-                                    log.error(pos, "not.loop.label", label);
+                                    log.error(pos, Errors.NotLoopLabel(label));
                                 // Found labelled statement target, now go inwards
                                 // to next non-labelled tree.
                                 return TreeInfo.referencedStatement(labelled);
@@ -1747,11 +1747,11 @@
                 env1 = env1.next;
             }
             if (label != null)
-                log.error(pos, "undef.label", label);
+                log.error(pos, Errors.UndefLabel(label));
             else if (tag == CONTINUE)
-                log.error(pos, "cont.outside.loop");
+                log.error(pos, Errors.ContOutsideLoop);
             else
-                log.error(pos, "break.outside.switch.loop");
+                log.error(pos, Errors.BreakOutsideSwitchLoop);
             return null;
         }
 
@@ -1759,20 +1759,20 @@
         // Check that there is an enclosing method which is
         // nested within than the enclosing class.
         if (env.info.returnResult == null) {
-            log.error(tree.pos(), "ret.outside.meth");
+            log.error(tree.pos(), Errors.RetOutsideMeth);
         } else {
             // Attribute return expression, if it exists, and check that
             // it conforms to result type of enclosing method.
             if (tree.expr != null) {
                 if (env.info.returnResult.pt.hasTag(VOID)) {
                     env.info.returnResult.checkContext.report(tree.expr.pos(),
-                              diags.fragment("unexpected.ret.val"));
+                              diags.fragment(Fragments.UnexpectedRetVal));
                 }
                 attribTree(tree.expr, env, env.info.returnResult);
             } else if (!env.info.returnResult.pt.hasTag(VOID) &&
                     !env.info.returnResult.pt.hasTag(NONE)) {
                 env.info.returnResult.checkContext.report(tree.pos(),
-                              diags.fragment("missing.ret.val"));
+                              diags.fragment(Fragments.MissingRetVal(env.info.returnResult.pt)));
             }
         }
         result = null;
@@ -1834,7 +1834,7 @@
                 Type site = env.enclClass.sym.type;
                 if (methName == names._super) {
                     if (site == syms.objectType) {
-                        log.error(tree.meth.pos(), "no.superclass", site);
+                        log.error(tree.meth.pos(), Errors.NoSuperclass(site));
                         site = types.createErrorType(syms.objectType);
                     } else {
                         site = types.supertype(site);
@@ -1865,8 +1865,8 @@
                                                    localEnv, site, true);
                         }
                     } else if (tree.meth.hasTag(SELECT)) {
-                        log.error(tree.meth.pos(), "illegal.qual.not.icls",
-                                  site.tsym);
+                        log.error(tree.meth.pos(),
+                                  Errors.IllegalQualNotIcls(site.tsym));
                     }
 
                     // if we're calling a java.lang.Enum constructor,
@@ -1968,8 +1968,8 @@
                     ((JCExpressionStatement) body.stats.head).expr == tree)
                     return true;
             }
-            log.error(tree.pos(),"call.must.be.first.stmt.in.ctor",
-                      TreeInfo.name(tree.meth));
+            log.error(tree.pos(),
+                      Errors.CallMustBeFirstStmtInCtor(TreeInfo.name(tree.meth)));
             return false;
         }
 
@@ -2080,9 +2080,9 @@
             }
             if (!clazztype.isErroneous()) {
                 if (cdef != null && clazztype.tsym.isInterface()) {
-                    log.error(tree.encl.pos(), "anon.class.impl.intf.no.qual.for.new");
+                    log.error(tree.encl.pos(), Errors.AnonClassImplIntfNoQualForNew);
                 } else if (clazztype.tsym.isStatic()) {
-                    log.error(tree.encl.pos(), "qualified.new.of.static.class", clazztype.tsym);
+                    log.error(tree.encl.pos(), Errors.QualifiedNewOfStaticClass(clazztype.tsym));
                 }
             }
         } else if (!clazztype.tsym.isInterface() &&
@@ -2105,7 +2105,7 @@
                 (!env.tree.hasTag(VARDEF) ||
                  (((JCVariableDecl) env.tree).mods.flags & Flags.ENUM) == 0 ||
                  ((JCVariableDecl) env.tree).init != tree))
-                log.error(tree.pos(), "enum.cant.be.instantiated");
+                log.error(tree.pos(), Errors.EnumCantBeInstantiated);
 
             boolean isSpeculativeDiamondInferenceRound = TreeInfo.isDiamond(tree) &&
                     resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.SPECULATIVE;
@@ -2113,17 +2113,17 @@
             // Check that class is not abstract
             if (cdef == null && !isSpeculativeDiamondInferenceRound && // class body may be nulled out in speculative tree copy
                 (clazztype.tsym.flags() & (ABSTRACT | INTERFACE)) != 0) {
-                log.error(tree.pos(), "abstract.cant.be.instantiated",
-                          clazztype.tsym);
+                log.error(tree.pos(),
+                          Errors.AbstractCantBeInstantiated(clazztype.tsym));
                 skipNonDiamondPath = true;
             } else if (cdef != null && clazztype.tsym.isInterface()) {
                 // Check that no constructor arguments are given to
                 // anonymous classes implementing an interface
                 if (!argtypes.isEmpty())
-                    log.error(tree.args.head.pos(), "anon.class.impl.intf.no.args");
+                    log.error(tree.args.head.pos(), Errors.AnonClassImplIntfNoArgs);
 
                 if (!typeargtypes.isEmpty())
-                    log.error(tree.typeargs.head.pos(), "anon.class.impl.intf.no.typeargs");
+                    log.error(tree.typeargs.head.pos(), Errors.AnonClassImplIntfNoTypeargs);
 
                 // Error recovery: pretend no arguments were supplied.
                 argtypes = List.nil();
@@ -2342,7 +2342,7 @@
                 @Override
                 public void report(DiagnosticPosition _unused, JCDiagnostic details) {
                     enclosingContext.report(clazz.clazz,
-                            diags.fragment("cant.apply.diamond.1", diags.fragment("diamond", tsym), details));
+                            diags.fragment(Fragments.CantApplyDiamond1(Fragments.Diamond(tsym), details)));
                 }
             };
         }
@@ -2383,8 +2383,8 @@
                 elemtype = types.elemtype(pt());
             } else {
                 if (!pt().hasTag(ERROR)) {
-                    log.error(tree.pos(), "illegal.initializer.for.type",
-                              pt());
+                    log.error(tree.pos(),
+                              Errors.IllegalInitializerForType(pt()));
                 }
                 elemtype = types.createErrorType(pt());
             }
@@ -2394,7 +2394,7 @@
             owntype = new ArrayType(elemtype, syms.arrayClass);
         }
         if (!types.isReifiable(elemtype))
-            log.error(tree.pos(), "generic.array.creation");
+            log.error(tree.pos(), Errors.GenericArrayCreation);
         result = check(tree, owntype, KindSelector.VAL, resultInfo);
     }
 
@@ -2409,7 +2409,7 @@
         if (pt().isErroneous() || (pt().hasTag(NONE) && pt() != Type.recoveryType)) {
             if (pt().hasTag(NONE)) {
                 //lambda only allowed in assignment or method invocation/cast context
-                log.error(that.pos(), "unexpected.lambda");
+                log.error(that.pos(), Errors.UnexpectedLambda);
             }
             result = that.type = types.createErrorType(pt());
             return;
@@ -2443,8 +2443,10 @@
 
             if (lambdaType.hasTag(FORALL)) {
                 //lambda expression target desc cannot be a generic method
-                resultInfo.checkContext.report(that, diags.fragment("invalid.generic.lambda.target",
-                        lambdaType, kindName(currentTarget.tsym), currentTarget.tsym));
+                Fragment msg = Fragments.InvalidGenericLambdaTarget(lambdaType,
+                                                                    kindName(currentTarget.tsym),
+                                                                    currentTarget.tsym);
+                resultInfo.checkContext.report(that, diags.fragment(msg));
                 result = that.type = types.createErrorType(pt());
                 return;
             }
@@ -2477,7 +2479,7 @@
                 attribStats(that.params, localEnv);
 
                 if (arityMismatch) {
-                    resultInfo.checkContext.report(that, diags.fragment("incompatible.arg.types.in.lambda"));
+                    resultInfo.checkContext.report(that, diags.fragment(Fragments.IncompatibleArgTypesInLambda));
                         result = that.type = types.createErrorType(currentTarget);
                         return;
                 }
@@ -2576,8 +2578,10 @@
             }
             if (that.hasTag(LAMBDA) && lambdaType.hasTag(FORALL)) {
                 //lambda expression target desc cannot be a generic method
-                resultInfo.checkContext.report(that, diags.fragment("invalid.generic.lambda.target",
-                        lambdaType, kindName(currentTarget.tsym), currentTarget.tsym));
+                Fragment msg = Fragments.InvalidGenericLambdaTarget(lambdaType,
+                                                                    kindName(currentTarget.tsym),
+                                                                    currentTarget.tsym);
+                resultInfo.checkContext.report(that, diags.fragment(msg));
                 currentTarget = types.createErrorType(pt());
             }
             return new TargetInfo(currentTarget, lambdaType);
@@ -2640,8 +2644,8 @@
             }
 
             private void reportIntersectionError(DiagnosticPosition pos, String key, Object... args) {
-                resultInfo.checkContext.report(pos, diags.fragment("bad.intersection.target.for.functional.expr",
-                        diags.fragment(key, args)));
+                resultInfo.checkContext.report(pos,
+                                               diags.fragment(Fragments.BadIntersectionTargetForFunctionalExpr(diags.fragment(key, args))));
             }
         };
 
@@ -2703,7 +2707,7 @@
 
             @Override
             public void report(DiagnosticPosition pos, JCDiagnostic details) {
-                enclosingContext.report(pos, diags.fragment("incompatible.ret.type.in.lambda", details));
+                enclosingContext.report(pos, diags.fragment(Fragments.IncompatibleRetTypeInLambda(details)));
             }
         }
 
@@ -2764,13 +2768,15 @@
             //the descriptor's return type must be void
             if (tree.getBodyKind() == JCLambda.BodyKind.STATEMENT && tree.canCompleteNormally &&
                     !returnType.hasTag(VOID) && returnType != Type.recoveryType) {
-                checkContext.report(tree, diags.fragment("incompatible.ret.type.in.lambda",
-                        diags.fragment("missing.ret.val", returnType)));
+                Fragment msg =
+                        Fragments.IncompatibleRetTypeInLambda(Fragments.MissingRetVal(returnType));
+                checkContext.report(tree,
+                                    diags.fragment(msg));
             }
 
             List<Type> argTypes = checkContext.inferenceContext().asUndetVars(descriptor.getParameterTypes());
             if (!types.isSameTypes(argTypes, TreeInfo.types(tree.params))) {
-                checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
+                checkContext.report(tree, diags.fragment(Fragments.IncompatibleArgTypesInLambda));
             }
         }
 
@@ -2841,7 +2847,7 @@
         if (pt().isErroneous() || (pt().hasTag(NONE) && pt() != Type.recoveryType)) {
             if (pt().hasTag(NONE)) {
                 //method reference only allowed in assignment or method invocation/cast context
-                log.error(that.pos(), "unexpected.mref");
+                log.error(that.pos(), Errors.UnexpectedMref);
             }
             result = that.type = types.createErrorType(pt());
             return;
@@ -2857,8 +2863,9 @@
                 if (!exprType.isErroneous() &&
                     exprType.isRaw() &&
                     that.typeargs != null) {
-                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
-                        diags.fragment("mref.infer.and.explicit.params"));
+                    log.error(that.expr.pos(),
+                              Errors.InvalidMref(Kinds.kindName(that.getMode()),
+                                                 Fragments.MrefInferAndExplicitParams));
                     exprType = types.createErrorType(exprType);
                 }
             }
@@ -2990,8 +2997,9 @@
                 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) &&
                         exprType.getTypeArguments().nonEmpty()) {
                     //static ref with class type-args
-                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
-                            diags.fragment("static.mref.with.targs"));
+                    log.error(that.expr.pos(),
+                              Errors.InvalidMref(Kinds.kindName(that.getMode()),
+                                                 Fragments.StaticMrefWithTargs));
                     result = that.type = types.createErrorType(currentTarget);
                     return;
                 }
@@ -3088,8 +3096,9 @@
         }
 
         if (incompatibleReturnType != null) {
-            checkContext.report(tree, diags.fragment("incompatible.ret.type.in.mref",
-                    diags.fragment("inconvertible.types", resType, descriptor.getReturnType())));
+            Fragment msg =
+                    Fragments.IncompatibleRetTypeInMref(Fragments.InconvertibleTypes(resType, descriptor.getReturnType()));
+            checkContext.report(tree, diags.fragment(msg));
         } else {
             if (inferenceContext.free(refType)) {
                 // we need to wait for inference to finish and then replace inference vars in the referent type
@@ -3105,7 +3114,7 @@
         if (!speculativeAttr) {
             List<Type> thrownTypes = inferenceContext.asUndetVars(descriptor.getThrownTypes());
             if (chk.unhandled(refType.getThrownTypes(), thrownTypes).nonEmpty()) {
-                log.error(tree, "incompatible.thrown.types.in.mref", refType.getThrownTypes());
+                log.error(tree, Errors.IncompatibleThrownTypesInMref(refType.getThrownTypes()));
             }
             //18.2.5: "In addition, for all j (1 <= j <= n), the constraint reduces to the bound throws Ej"
             thrownTypes.stream()
@@ -3176,7 +3185,7 @@
         result = check(tree, owntype, pkind(), resultInfo);
         Symbol sym = TreeInfo.symbol(tree);
         if (sym != null && sym.kind.matches(KindSelector.TYP_PCK))
-            log.error(tree.pos(), "illegal.start.of.type");
+            log.error(tree.pos(), Errors.IllegalStartOfType);
     }
 
     public void visitAssign(JCAssign tree) {
@@ -3255,7 +3264,7 @@
             // comparisons will not have an acmp* opc at this point.
             if ((opc == ByteCodes.if_acmpeq || opc == ByteCodes.if_acmpne)) {
                 if (!types.isCastable(left, right, new Warner(tree.pos()))) {
-                    log.error(tree.pos(), "incomparable.types", left, right);
+                    log.error(tree.pos(), Errors.IncomparableTypes(left, right));
                 }
             }
 
@@ -3304,7 +3313,7 @@
             clazztype = chk.checkClassOrArrayType(tree.clazz.pos(), clazztype);
         }
         if (!clazztype.isErroneous() && !types.isReifiable(clazztype)) {
-            log.error(tree.clazz.pos(), "illegal.generic.type.for.instof");
+            log.error(tree.clazz.pos(), Errors.IllegalGenericTypeForInstof);
             clazztype = types.createErrorType(clazztype);
         }
         chk.validate(tree.clazz, env, false);
@@ -3319,7 +3328,7 @@
         if (types.isArray(atype))
             owntype = types.elemtype(atype);
         else if (!atype.hasTag(ERROR))
-            log.error(tree.pos(), "array.req.but.found", atype);
+            log.error(tree.pos(), Errors.ArrayReqButFound(atype));
         if (!pkind().contains(KindSelector.VAL))
             owntype = capture(owntype);
         result = check(tree, owntype, KindSelector.VAR, resultInfo);
@@ -3432,7 +3441,7 @@
             while (elt.hasTag(ARRAY))
                 elt = ((ArrayType)elt).elemtype;
             if (elt.hasTag(TYPEVAR)) {
-                log.error(tree.pos(), "type.var.cant.be.deref");
+                log.error(tree.pos(), Errors.TypeVarCantBeDeref);
                 result = tree.type = types.createErrorType(tree.name, site.tsym, site);
                 tree.sym = tree.type.tsym;
                 return ;
@@ -3452,7 +3461,7 @@
         env.info.pendingResolutionPhase = null;
         Symbol sym = selectSym(tree, sitesym, site, env, resultInfo);
         if (sym.kind == VAR && sym.name != names._super && env.info.defaultSuperCallSite != null) {
-            log.error(tree.selected.pos(), "not.encl.class", site.tsym);
+            log.error(tree.selected.pos(), Errors.NotEnclClass(site.tsym));
             sym = syms.errSymbol;
         }
         if (sym.exists() && !isType(sym) && pkind().contains(KindSelector.TYP_PCK)) {
@@ -3487,7 +3496,7 @@
                 sym.name.equals(names.close) &&
                 sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) &&
                 env.info.lint.isEnabled(LintCategory.TRY)) {
-            log.warning(LintCategory.TRY, tree, "try.explicit.close.call");
+            log.warning(LintCategory.TRY, tree, Warnings.TryExplicitCloseCall);
         }
 
         // Disallow selecting a type from an expression
@@ -3517,7 +3526,7 @@
             }
             if (!allowStaticInterfaceMethods && sitesym.isInterface() &&
                     sym.isStatic() && sym.kind == MTH) {
-                log.error(DiagnosticFlag.SOURCE_LEVEL, tree.pos(), "static.intf.method.invoke.not.supported.in.source", sourceName);
+                log.error(DiagnosticFlag.SOURCE_LEVEL, tree.pos(), Errors.StaticIntfMethodInvokeNotSupportedInSource(sourceName));
             }
         } else if (sym.kind != ERR &&
                    (sym.flags() & STATIC) != 0 &&
@@ -3602,7 +3611,7 @@
                     ? selectSym(tree, location, capture(site.getUpperBound()), env, resultInfo)
                     : null;
                 if (sym == null) {
-                    log.error(pos, "type.var.cant.be.deref");
+                    log.error(pos, Errors.TypeVarCantBeDeref);
                     return syms.errSymbol;
                 } else {
                     Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
@@ -3626,7 +3635,7 @@
                     return new VarSymbol(
                         STATIC | PUBLIC | FINAL, names._class, t, site.tsym);
                 } else {
-                    log.error(pos, "cant.deref", site);
+                    log.error(pos, Errors.CantDeref(site));
                     return syms.errSymbol;
                 }
             }
@@ -3926,7 +3935,7 @@
                 if (!Resolve.isInitializer(env))
                     return;
 
-                log.error(tree.pos(), "illegal.enum.static.ref");
+                log.error(tree.pos(), Errors.IllegalEnumStaticRef);
             }
         }
 
@@ -3973,8 +3982,8 @@
                 if (icand_sup.nonEmpty() &&
                         icand_sup.head != sym &&
                         icand_sup.head.overrides(sym, icand_sup.head.enclClass(), types, true)) {
-                    log.error(env.tree.pos(), "illegal.default.super.call", env.info.defaultSuperCallSite,
-                        diags.fragment("overridden.default", sym, sup));
+                    log.error(env.tree.pos(),
+                              Errors.IllegalDefaultSuperCall(env.info.defaultSuperCallSite, Fragments.OverriddenDefault(sym, sup)));
                     break;
                 }
             }
@@ -3985,7 +3994,7 @@
             JCMethodInvocation app = (JCMethodInvocation)env.tree;
             if (app.meth.hasTag(SELECT) &&
                     !TreeInfo.isStaticSelector(((JCFieldAccess)app.meth).selected, names)) {
-                log.error(env.tree.pos(), "illegal.static.intf.meth.call", site);
+                log.error(env.tree.pos(), Errors.IllegalStaticIntfMethCall(site));
             }
         }
 
@@ -4130,10 +4139,10 @@
                                         clazztype.getMetadata());
             } else {
                 if (formals.length() != 0) {
-                    log.error(tree.pos(), "wrong.number.type.args",
-                              Integer.toString(formals.length()));
+                    log.error(tree.pos(),
+                              Errors.WrongNumberTypeArgs(Integer.toString(formals.length())));
                 } else {
-                    log.error(tree.pos(), "type.doesnt.take.params", clazztype.tsym);
+                    log.error(tree.pos(), Errors.TypeDoesntTakeParams(clazztype.tsym));
                 }
                 owntype = types.createErrorType(tree.type);
             }
@@ -4160,7 +4169,7 @@
                             //assume 'a' <: 'b'
                             Type a = sub ? ctype : t;
                             Type b = sub ? t : ctype;
-                            log.error(typeTree.pos(), "multicatch.types.must.be.disjoint", a, b);
+                            log.error(typeTree.pos(), Errors.MulticatchTypesMustBeDisjoint(a, b));
                         }
                     }
                 }
@@ -4216,7 +4225,7 @@
                 // if first bound was a typevar, do not accept further bounds.
                 if (bounds.tail.nonEmpty()) {
                     log.error(bounds.tail.head.pos(),
-                              "type.var.may.not.be.followed.by.other.bounds");
+                              Errors.TypeVarMayNotBeFollowedByOtherBounds);
                     return bounds.head.type;
                 }
             } else {
@@ -4438,13 +4447,13 @@
                 // java.lang.Enum may not be subclassed by a non-enum
                 if (st.tsym == syms.enumSym &&
                     ((c.flags_field & (Flags.ENUM|Flags.COMPOUND)) == 0))
-                    log.error(env.tree.pos(), "enum.no.subclassing");
+                    log.error(env.tree.pos(), Errors.EnumNoSubclassing);
 
                 // Enums may not be extended by source-level classes
                 if (st.tsym != null &&
                     ((st.tsym.flags_field & Flags.ENUM) != 0) &&
                     ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {
-                    log.error(env.tree.pos(), "enum.types.not.extensible");
+                    log.error(env.tree.pos(), Errors.EnumTypesNotExtensible);
                 }
 
                 if (isSerializable(c.type)) {
@@ -4510,10 +4519,11 @@
         if ((c.flags() & ANNOTATION) != 0) {
             if (tree.implementing.nonEmpty())
                 log.error(tree.implementing.head.pos(),
-                          "cant.extend.intf.annotation");
-            if (tree.typarams.nonEmpty())
+                          Errors.CantExtendIntfAnnotation);
+            if (tree.typarams.nonEmpty()) {
                 log.error(tree.typarams.head.pos(),
-                          "intf.annotation.cant.have.type.params");
+                          Errors.IntfAnnotationCantHaveTypeParams(c));
+            }
 
             // If this annotation type has a @Repeatable, validate
             Attribute.Compound repeatable = c.getAnnotationTypeMetadata().getRepeatable();
@@ -4548,7 +4558,7 @@
 
         // Check that a generic class doesn't extend Throwable
         if (!c.type.allparams().isEmpty() && types.isSubtype(c.type, syms.throwableType))
-            log.error(tree.extending.pos(), "generic.throwable");
+            log.error(tree.extending.pos(), Errors.GenericThrowable);
 
         // Check that all methods which implement some
         // method conform to the method they implement.
@@ -4570,7 +4580,7 @@
                 if (sym == null ||
                     sym.kind != VAR ||
                     ((VarSymbol) sym).getConstValue() == null)
-                    log.error(l.head.pos(), "icls.cant.have.static.decl", c);
+                    log.error(l.head.pos(), Errors.IclsCantHaveStaticDecl(c));
             }
         }
 
@@ -4643,7 +4653,7 @@
 
             if (svuid == null) {
                 log.warning(LintCategory.SERIAL,
-                        tree.pos(), "missing.SVUID", c);
+                        tree.pos(), Warnings.MissingSVUID(c));
                 return;
             }
 
@@ -4651,17 +4661,17 @@
             if ((svuid.flags() & (STATIC | FINAL)) !=
                 (STATIC | FINAL))
                 log.warning(LintCategory.SERIAL,
-                        TreeInfo.diagnosticPositionFor(svuid, tree), "improper.SVUID", c);
+                        TreeInfo.diagnosticPositionFor(svuid, tree), Warnings.ImproperSVUID(c));
 
             // check that it is long
             else if (!svuid.type.hasTag(LONG))
                 log.warning(LintCategory.SERIAL,
-                        TreeInfo.diagnosticPositionFor(svuid, tree), "long.SVUID", c);
+                        TreeInfo.diagnosticPositionFor(svuid, tree), Warnings.LongSVUID(c));
 
             // check constant
             else if (svuid.getConstValue() == null)
                 log.warning(LintCategory.SERIAL,
-                        TreeInfo.diagnosticPositionFor(svuid, tree), "constant.SVUID", c);
+                        TreeInfo.diagnosticPositionFor(svuid, tree), Warnings.ConstantSVUID(c));
         }
 
     private Type capture(Type type) {
@@ -4831,13 +4841,13 @@
                     JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
                     if (enclTy == null || enclTy.hasTag(NONE)) {
                         if (at.getAnnotations().size() == 1) {
-                            log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
+                            log.error(at.underlyingType.pos(), Errors.CantTypeAnnotateScoping1(at.getAnnotations().head.attribute));
                         } else {
                             ListBuffer<Attribute.Compound> comps = new ListBuffer<>();
                             for (JCAnnotation an : at.getAnnotations()) {
                                 comps.add(an.attribute);
                             }
-                            log.error(at.underlyingType.pos(), "cant.type.annotate.scoping", comps.toList());
+                            log.error(at.underlyingType.pos(), Errors.CantTypeAnnotateScoping(comps.toList()));
                         }
                         repeat = false;
                     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jun 15 13:44:42 2017 +0200
@@ -42,6 +42,7 @@
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.util.JCDiagnostic.Fragment;
 import com.sun.tools.javac.util.List;
 
 import com.sun.tools.javac.code.Lint;
@@ -269,7 +270,7 @@
      */
     void warnDivZero(DiagnosticPosition pos) {
         if (lint.isEnabled(LintCategory.DIVZERO))
-            log.warning(LintCategory.DIVZERO, pos, "div.zero");
+            log.warning(LintCategory.DIVZERO, pos, Warnings.DivZero);
     }
 
     /**
@@ -288,7 +289,7 @@
      *  @param ex         The failure to report.
      */
     public Type completionError(DiagnosticPosition pos, CompletionFailure ex) {
-        log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, pos, "cant.access", ex.sym, ex.getDetailValue());
+        log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, pos, Errors.CantAccess(ex.sym, ex.getDetailValue()));
         if (ex instanceof ClassFinder.BadClassFile) throw new Abort();
         else return syms.errType;
     }
@@ -299,14 +300,14 @@
      *                    required.
      *  @param found      The type that was found.
      */
-    Type typeTagError(DiagnosticPosition pos, Object required, Object found) {
+    Type typeTagError(DiagnosticPosition pos, JCDiagnostic required, Object found) {
         // this error used to be raised by the parser,
         // but has been delayed to this point:
         if (found instanceof Type && ((Type)found).hasTag(VOID)) {
-            log.error(pos, "illegal.start.of.type");
+            log.error(pos, Errors.IllegalStartOfType);
             return syms.errType;
         }
-        log.error(pos, "type.found.req", found, required);
+        log.error(pos, Errors.TypeFoundReq(found, required));
         return types.createErrorType(found instanceof Type ? (Type)found : syms.errType);
     }
 
@@ -316,7 +317,7 @@
      *  @param sym        The referenced symbol.
      */
     void earlyRefError(DiagnosticPosition pos, Symbol sym) {
-        log.error(pos, "cant.ref.before.ctor.called", sym);
+        log.error(pos, Errors.CantRefBeforeCtorCalled(sym));
     }
 
     /** Report duplicate declaration error.
@@ -326,12 +327,18 @@
             Symbol location = sym.location();
             if (location.kind == MTH &&
                     ((MethodSymbol)location).isStaticOrInstanceInit()) {
-                log.error(pos, "already.defined.in.clinit", kindName(sym), sym,
-                        kindName(sym.location()), kindName(sym.location().enclClass()),
-                        sym.location().enclClass());
+                log.error(pos,
+                          Errors.AlreadyDefinedInClinit(kindName(sym),
+                                                        sym,
+                                                        kindName(sym.location()),
+                                                        kindName(sym.location().enclClass()),
+                                                        sym.location().enclClass()));
             } else {
-                log.error(pos, "already.defined", kindName(sym), sym,
-                        kindName(sym.location()), sym.location());
+                log.error(pos,
+                          Errors.AlreadyDefined(kindName(sym),
+                                                sym,
+                                                kindName(sym.location()),
+                                                sym.location()));
             }
         }
     }
@@ -340,7 +347,7 @@
      */
     void varargsDuplicateError(DiagnosticPosition pos, Symbol sym1, Symbol sym2) {
         if (!sym1.type.isErroneous() && !sym2.type.isErroneous()) {
-            log.error(pos, "array.and.varargs", sym1, sym2, sym2.location());
+            log.error(pos, Errors.ArrayAndVarargs(sym1, sym2, sym2.location()));
         }
     }
 
@@ -530,7 +537,7 @@
      */
     CheckContext basicHandler = new CheckContext() {
         public void report(DiagnosticPosition pos, JCDiagnostic details) {
-            log.error(pos, "prob.found.req", details);
+            log.error(pos, Errors.ProbFoundReq(details));
         }
         public boolean compatible(Type found, Type req, Warner warn) {
             return types.isAssignable(found, req, warn);
@@ -578,10 +585,10 @@
             return found;
         } else {
             if (found.isNumeric() && req.isNumeric()) {
-                checkContext.report(pos, diags.fragment("possible.loss.of.precision", found, req));
+                checkContext.report(pos, diags.fragment(Fragments.PossibleLossOfPrecision(found, req)));
                 return types.createErrorType(found);
             }
-            checkContext.report(pos, diags.fragment("inconvertible.types", found, req));
+            checkContext.report(pos, diags.fragment(Fragments.InconvertibleTypes(found, req)));
             return types.createErrorType(found);
         }
     }
@@ -599,7 +606,7 @@
         if (types.isCastable(found, req, castWarner(pos, found, req))) {
             return req;
         } else {
-            checkContext.report(pos, diags.fragment("inconvertible.types", found, req));
+            checkContext.report(pos, diags.fragment(Fragments.InconvertibleTypes(found, req)));
             return types.createErrorType(found);
         }
     }
@@ -615,7 +622,7 @@
             deferredLintHandler.report(() -> {
                 if (lint.isEnabled(LintCategory.CAST))
                     log.warning(LintCategory.CAST,
-                            tree.pos(), "redundant.cast", tree.clazz.type);
+                            tree.pos(), Warnings.RedundantCast(tree.clazz.type));
             });
         }
     }
@@ -662,7 +669,7 @@
      */
     Type checkNonVoid(DiagnosticPosition pos, Type t) {
         if (t.hasTag(VOID)) {
-            log.error(pos, "void.not.allowed.here");
+            log.error(pos, Errors.VoidNotAllowedHere);
             return types.createErrorType(t);
         } else {
             return t;
@@ -672,7 +679,7 @@
     Type checkClassOrArrayType(DiagnosticPosition pos, Type t) {
         if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) {
             return typeTagError(pos,
-                                diags.fragment("type.req.class.array"),
+                                diags.fragment(Fragments.TypeReqClassArray),
                                 asTypeParam(t));
         } else {
             return t;
@@ -686,7 +693,7 @@
     Type checkClassType(DiagnosticPosition pos, Type t) {
         if (!t.hasTag(CLASS) && !t.hasTag(ERROR)) {
             return typeTagError(pos,
-                                diags.fragment("type.req.class"),
+                                diags.fragment(Fragments.TypeReqClass),
                                 asTypeParam(t));
         } else {
             return t;
@@ -695,7 +702,7 @@
     //where
         private Object asTypeParam(Type t) {
             return (t.hasTag(TYPEVAR))
-                                    ? diags.fragment("type.parameter", t)
+                                    ? diags.fragment(Fragments.TypeParameter(t))
                                     : t;
         }
 
@@ -705,17 +712,17 @@
         t = checkClassOrArrayType(pos, t);
         if (t.hasTag(CLASS)) {
             if ((t.tsym.flags() & (ABSTRACT | INTERFACE)) != 0) {
-                log.error(pos, "abstract.cant.be.instantiated", t.tsym);
+                log.error(pos, Errors.AbstractCantBeInstantiated(t.tsym));
                 t = types.createErrorType(t);
             } else if ((t.tsym.flags() & ENUM) != 0) {
-                log.error(pos, "enum.cant.be.instantiated");
+                log.error(pos, Errors.EnumCantBeInstantiated);
                 t = types.createErrorType(t);
             } else {
                 t = checkClassType(pos, t, true);
             }
         } else if (t.hasTag(ARRAY)) {
             if (!types.isReifiable(((ArrayType)t).elemtype)) {
-                log.error(pos, "generic.array.creation");
+                log.error(pos, Errors.GenericArrayCreation);
                 t = types.createErrorType(t);
             }
         }
@@ -734,7 +741,7 @@
             while (args.nonEmpty()) {
                 if (args.head.hasTag(WILDCARD))
                     return typeTagError(pos,
-                                        diags.fragment("type.req.exact"),
+                                        diags.fragment(Fragments.TypeReqExact),
                                         args.head);
                 args = args.tail;
             }
@@ -752,7 +759,7 @@
             return t;
         else
             return typeTagError(pos,
-                                diags.fragment("type.req.ref"),
+                                diags.fragment(Fragments.TypeReqRef),
                                 t);
     }
 
@@ -779,7 +786,7 @@
             return t;
         else
             return typeTagError(pos,
-                                diags.fragment("type.req.ref"),
+                                diags.fragment(Fragments.TypeReqRef),
                                 t);
     }
 
@@ -793,9 +800,8 @@
     boolean checkDisjoint(DiagnosticPosition pos, long flags, long set1, long set2) {
         if ((flags & set1) != 0 && (flags & set2) != 0) {
             log.error(pos,
-                      "illegal.combination.of.modifiers",
-                      asFlagSet(TreeInfo.firstFlag(flags & set1)),
-                      asFlagSet(TreeInfo.firstFlag(flags & set2)));
+                      Errors.IllegalCombinationOfModifiers(asFlagSet(TreeInfo.firstFlag(flags & set1)),
+                                                           asFlagSet(TreeInfo.firstFlag(flags & set2))));
             return false;
         } else
             return true;
@@ -815,14 +821,14 @@
             }
             if (t.tsym.type.getTypeArguments().isEmpty()) {
                 log.error(tree.clazz.pos(),
-                    "cant.apply.diamond.1",
-                    t, diags.fragment("diamond.non.generic", t));
+                          Errors.CantApplyDiamond1(t,
+                                                   Fragments.DiamondNonGeneric(t)));
                 return types.createErrorType(t);
             } else if (tree.typeargs != null &&
                     tree.typeargs.nonEmpty()) {
                 log.error(tree.clazz.pos(),
-                    "cant.apply.diamond.1",
-                    t, diags.fragment("diamond.and.explicit.params", t));
+                          Errors.CantApplyDiamond1(t,
+                                                   Fragments.DiamondAndExplicitParams(t)));
                 return types.createErrorType(t);
             } else {
                 return t;
@@ -905,24 +911,23 @@
         }
         if (hasTrustMeAnno && !isTrustMeAllowedOnMethod(m)) {
             if (varargElemType != null) {
+                JCDiagnostic msg = allowPrivateSafeVarargs ?
+                        diags.fragment(Fragments.VarargsTrustmeOnVirtualVarargs(m)) :
+                        diags.fragment(Fragments.VarargsTrustmeOnVirtualVarargsFinalOnly(m));
                 log.error(tree,
-                        "varargs.invalid.trustme.anno",
-                          syms.trustMeType.tsym,
-                          allowPrivateSafeVarargs ?
-                          diags.fragment("varargs.trustme.on.virtual.varargs", m) :
-                          diags.fragment("varargs.trustme.on.virtual.varargs.final.only", m));
+                          Errors.VarargsInvalidTrustmeAnno(syms.trustMeType.tsym,
+                                                           msg));
             } else {
                 log.error(tree,
-                            "varargs.invalid.trustme.anno",
-                            syms.trustMeType.tsym,
-                            diags.fragment("varargs.trustme.on.non.varargs.meth", m));
+                          Errors.VarargsInvalidTrustmeAnno(syms.trustMeType.tsym,
+                                                           Fragments.VarargsTrustmeOnNonVarargsMeth(m)));
             }
         } else if (hasTrustMeAnno && varargElemType != null &&
                             types.isReifiable(varargElemType)) {
             warnUnsafeVararg(tree,
                             "varargs.redundant.trustme.anno",
                             syms.trustMeType.tsym,
-                            diags.fragment("varargs.trustme.on.reifiable.varargs", varargElemType));
+                            diags.fragment(Fragments.VarargsTrustmeOnReifiableVarargs(varargElemType)));
         }
         else if (!hasTrustMeAnno && varargElemType != null &&
                 !types.isReifiable(varargElemType)) {
@@ -986,8 +991,8 @@
                 Type lastArg = argtypes.last();
                 if (types.isSubtypeUnchecked(lastArg, types.elemtype(varParam)) &&
                     !types.isSameType(types.erasure(varParam), types.erasure(lastArg)))
-                    log.warning(argtrees.last().pos(), "inexact.non-varargs.call",
-                                types.elemtype(varParam), varParam);
+                    log.warning(argtrees.last().pos(),
+                                Warnings.InexactNonVarargsCall(types.elemtype(varParam),varParam));
             }
         }
         if (useVarargs) {
@@ -1172,14 +1177,14 @@
                 mask = LocalClassFlags;
                 if ((sym.owner.flags_field & STATIC) == 0 &&
                     (flags & ENUM) != 0)
-                    log.error(pos, "enums.must.be.static");
+                    log.error(pos, Errors.EnumsMustBeStatic);
             } else if (sym.owner.kind == TYP) {
                 mask = MemberClassFlags;
                 if (sym.owner.owner.kind == PCK ||
                     (sym.owner.flags_field & STATIC) != 0)
                     mask |= STATIC;
                 else if ((flags & ENUM) != 0)
-                    log.error(pos, "enums.must.be.static");
+                    log.error(pos, Errors.EnumsMustBeStatic);
                 // Nested interfaces and enums are always STATIC (Spec ???)
                 if ((flags & (INTERFACE | ENUM)) != 0 ) implicit = STATIC;
             } else {
@@ -1202,12 +1207,12 @@
         long illegal = flags & ExtendedStandardFlags & ~mask;
         if (illegal != 0) {
             if ((illegal & INTERFACE) != 0) {
-                log.error(pos, "intf.not.allowed.here");
+                log.error(pos, Errors.IntfNotAllowedHere);
                 mask |= INTERFACE;
             }
             else {
                 log.error(pos,
-                          "mod.not.allowed.here", asFlagSet(illegal));
+                          Errors.ModNotAllowedHere(asFlagSet(illegal)));
             }
         }
         else if ((sym.kind == TYP ||
@@ -1346,7 +1351,7 @@
                 if (incompatibleArg != null) {
                     for (JCTree arg : tree.arguments) {
                         if (arg.type == incompatibleArg) {
-                            log.error(arg, "not.within.bounds", incompatibleArg, forms.head);
+                            log.error(arg, Errors.NotWithinBounds(incompatibleArg, forms.head));
                         }
                         forms = forms.tail;
                      }
@@ -1369,7 +1374,7 @@
                 // Check that this type is either fully parameterized, or
                 // not parameterized at all.
                 if (tree.type.getEnclosingType().isRaw())
-                    log.error(tree.pos(), "improperly.formed.type.inner.raw.param");
+                    log.error(tree.pos(), Errors.ImproperlyFormedTypeInnerRawParam);
                 if (tree.clazz.hasTag(SELECT))
                     visitSelectInternal((JCFieldAccess)tree.clazz);
             }
@@ -1395,7 +1400,7 @@
                 // Check that this type is either fully parameterized, or
                 // not parameterized at all.
                 if (tree.selected.type.isParameterized() && tree.type.tsym.type.getTypeArguments().nonEmpty())
-                    log.error(tree.pos(), "improperly.formed.type.param.missing");
+                    log.error(tree.pos(), Errors.ImproperlyFormedTypeParamMissing);
             }
         }
 
@@ -1405,7 +1410,7 @@
                 // The enclosing type is not a class, so we are
                 // looking at a static member type.  However, the
                 // qualifying expression is parameterized.
-                log.error(tree.pos(), "cant.select.static.class.from.param.type");
+                log.error(tree.pos(), Errors.CantSelectStaticClassFromParamType);
             } else {
                 // otherwise validate the rest of the expression
                 tree.selected.accept(this);
@@ -1420,7 +1425,7 @@
         @Override
         public void visitTypeIdent(JCPrimitiveTypeTree that) {
             if (that.type.hasTag(TypeTag.VOID)) {
-                log.error(that.pos(), "void.not.allowed.here");
+                log.error(that.pos(), Errors.VoidNotAllowedHere);
             }
             super.visitTypeIdent(that);
         }
@@ -1462,7 +1467,7 @@
             !withinAnonConstr(env) &&
             tree.type.isRaw()) {
             log.warning(LintCategory.RAW,
-                    tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
+                    tree.pos(), Warnings.RawClassUse(tree.type, tree.type.tsym.type));
         }
     }
     //where
@@ -1613,15 +1618,16 @@
      *  @param other  The overridden method.
      *  @return       An internationalized string.
      */
-    Object cannotOverride(MethodSymbol m, MethodSymbol other) {
-        String key;
+    Fragment cannotOverride(MethodSymbol m, MethodSymbol other) {
+        Symbol mloc = m.location();
+        Symbol oloc = other.location();
+
         if ((other.owner.flags() & INTERFACE) == 0)
-            key = "cant.override";
+            return Fragments.CantOverride(m, mloc, other, oloc);
         else if ((m.owner.flags() & INTERFACE) == 0)
-            key = "cant.implement";
+            return Fragments.CantImplement(m, mloc, other, oloc);
         else
-            key = "clashes.with";
-        return diags.fragment(key, m, m.location(), other, other.location());
+            return Fragments.ClashesWith(m, mloc, other, oloc);
     }
 
     /** A customized "override" warning message.
@@ -1629,15 +1635,16 @@
      *  @param other  The overridden method.
      *  @return       An internationalized string.
      */
-    Object uncheckedOverrides(MethodSymbol m, MethodSymbol other) {
-        String key;
+    Fragment uncheckedOverrides(MethodSymbol m, MethodSymbol other) {
+        Symbol mloc = m.location();
+        Symbol oloc = other.location();
+
         if ((other.owner.flags() & INTERFACE) == 0)
-            key = "unchecked.override";
+            return Fragments.UncheckedOverride(m, mloc, other, oloc);
         else if ((m.owner.flags() & INTERFACE) == 0)
-            key = "unchecked.implement";
+            return Fragments.UncheckedImplement(m, mloc, other, oloc);
         else
-            key = "unchecked.clash.with";
-        return diags.fragment(key, m, m.location(), other, other.location());
+            return Fragments.UncheckedClashWith(m, mloc, other, oloc);
     }
 
     /** A customized "override" warning message.
@@ -1645,15 +1652,16 @@
      *  @param other  The overridden method.
      *  @return       An internationalized string.
      */
-    Object varargsOverrides(MethodSymbol m, MethodSymbol other) {
-        String key;
+    Fragment varargsOverrides(MethodSymbol m, MethodSymbol other) {
+        Symbol mloc = m.location();
+        Symbol oloc = other.location();
+
         if ((other.owner.flags() & INTERFACE) == 0)
-            key = "varargs.override";
+            return Fragments.VarargsOverride(m, mloc, other, oloc);
         else  if ((m.owner.flags() & INTERFACE) == 0)
-            key = "varargs.implement";
+            return Fragments.VarargsImplement(m, mloc, other, oloc);
         else
-            key = "varargs.clash.with";
-        return diags.fragment(key, m, m.location(), other, other.location());
+            return Fragments.VarargsClashWith(m, mloc, other, oloc);
     }
 
     /** Check that this method conforms with overridden method 'other'.
@@ -1689,8 +1697,8 @@
         // Error if static method overrides instance method (JLS 8.4.6.2).
         if ((m.flags() & STATIC) != 0 &&
                    (other.flags() & STATIC) == 0) {
-            log.error(TreeInfo.diagnosticPositionFor(m, tree), "override.static",
-                      cannotOverride(m, other));
+            log.error(TreeInfo.diagnosticPositionFor(m, tree),
+                      Errors.OverrideStatic(cannotOverride(m, other)));
             m.flags_field |= BAD_OVERRIDE;
             return;
         }
@@ -1700,9 +1708,9 @@
         if ((other.flags() & FINAL) != 0 ||
                  (m.flags() & STATIC) == 0 &&
                  (other.flags() & STATIC) != 0) {
-            log.error(TreeInfo.diagnosticPositionFor(m, tree), "override.meth",
-                      cannotOverride(m, other),
-                      asFlagSet(other.flags() & (FINAL | STATIC)));
+            log.error(TreeInfo.diagnosticPositionFor(m, tree),
+                      Errors.OverrideMeth(cannotOverride(m, other),
+                                          asFlagSet(other.flags() & (FINAL | STATIC))));
             m.flags_field |= BAD_OVERRIDE;
             return;
         }
@@ -1714,11 +1722,12 @@
 
         // Error if overriding method has weaker access (JLS 8.4.6.3).
         if (protection(m.flags()) > protection(other.flags())) {
-            log.error(TreeInfo.diagnosticPositionFor(m, tree), "override.weaker.access",
-                      cannotOverride(m, other),
+            log.error(TreeInfo.diagnosticPositionFor(m, tree),
                       (other.flags() & AccessFlags) == 0 ?
-                          "package" :
-                          asFlagSet(other.flags() & AccessFlags));
+                              Errors.OverrideWeakerAccess(cannotOverride(m, other),
+                                                          "package") :
+                              Errors.OverrideWeakerAccess(cannotOverride(m, other),
+                                                          asFlagSet(other.flags() & AccessFlags)));
             m.flags_field |= BAD_OVERRIDE;
             return;
         }
@@ -1740,14 +1749,12 @@
         if (!resultTypesOK) {
             if ((m.flags() & STATIC) != 0 && (other.flags() & STATIC) != 0) {
                 log.error(TreeInfo.diagnosticPositionFor(m, tree),
-                        Errors.OverrideIncompatibleRet(Fragments.CantHide(m, m.location(), other,
+                          Errors.OverrideIncompatibleRet(Fragments.CantHide(m, m.location(), other,
                                         other.location()), mtres, otres));
                 m.flags_field |= BAD_OVERRIDE;
             } else {
                 log.error(TreeInfo.diagnosticPositionFor(m, tree),
-                        "override.incompatible.ret",
-                        cannotOverride(m, other),
-                        mtres, otres);
+                          Errors.OverrideIncompatibleRet(cannotOverride(m, other), mtres, otres));
                 m.flags_field |= BAD_OVERRIDE;
             }
             return;
@@ -1765,9 +1772,7 @@
         List<Type> unhandledUnerased = unhandled(mt.getThrownTypes(), otthrown);
         if (unhandledErased.nonEmpty()) {
             log.error(TreeInfo.diagnosticPositionFor(m, tree),
-                      "override.meth.doesnt.throw",
-                      cannotOverride(m, other),
-                      unhandledUnerased.head);
+                      Errors.OverrideMethDoesntThrow(cannotOverride(m, other), unhandledUnerased.head));
             m.flags_field |= BAD_OVERRIDE;
             return;
         }
@@ -1784,15 +1789,14 @@
             && lint.isEnabled(LintCategory.OVERRIDES)) {
             log.warning(TreeInfo.diagnosticPositionFor(m, tree),
                         ((m.flags() & Flags.VARARGS) != 0)
-                        ? "override.varargs.missing"
-                        : "override.varargs.extra",
-                        varargsOverrides(m, other));
+                        ? Warnings.OverrideVarargsMissing(varargsOverrides(m, other))
+                        : Warnings.OverrideVarargsExtra(varargsOverrides(m, other)));
         }
 
         // Warn if instance method overrides bridge method (compiler spec ??)
         if ((other.flags() & BRIDGE) != 0) {
-            log.warning(TreeInfo.diagnosticPositionFor(m, tree), "override.bridge",
-                        uncheckedOverrides(m, other));
+            log.warning(TreeInfo.diagnosticPositionFor(m, tree),
+                        Warnings.OverrideBridge(uncheckedOverrides(m, other)));
         }
 
         // Warn if a deprecated method overridden by a non-deprecated one.
@@ -1871,8 +1875,8 @@
                             continue;
                         Type st2 = types.memberType(t2, s2);
                         if (types.overrideEquivalent(st1, st2))
-                            log.error(pos, "concrete.inheritance.conflict",
-                                      s1, t1, s2, t2, sup);
+                            log.error(pos,
+                                      Errors.ConcreteInheritanceConflict(s1, t1, s2, t2, sup));
                     }
                 }
             }
@@ -1971,9 +1975,8 @@
                          types.covariantReturnType(rt2, rt1, types.noWarnings)) ||
                          checkCommonOverriderIn(s1,s2,site);
                     if (!compat) {
-                        log.error(pos, "types.incompatible.diff.ret",
-                            t1, t2, s2.name +
-                            "(" + types.memberType(t2, s2).getParameterTypes() + ")");
+                        log.error(pos, Errors.TypesIncompatibleDiffRet(t1, t2, s2.name +
+                                "(" + types.memberType(t2, s2).getParameterTypes() + ")"));
                         return s2;
                     }
                 } else if (checkNameClash((ClassSymbol)site.tsym, s1, s2) &&
@@ -2017,7 +2020,7 @@
         ClassSymbol origin = (ClassSymbol)m.owner;
         if ((origin.flags() & ENUM) != 0 && names.finalize.equals(m.name))
             if (m.overrides(syms.enumFinalFinalize, origin, types, false)) {
-                log.error(tree.pos(), "enum.no.finalize");
+                log.error(tree.pos(), Errors.EnumNoFinalize);
                 return;
             }
         for (Type t = origin.type; t.hasTag(CLASS);
@@ -2097,7 +2100,7 @@
 
             if (overridesEquals && !overridesHashCode) {
                 log.warning(LintCategory.OVERRIDES, pos,
-                        "override.equals.but.not.hashcode", someClass);
+                            Warnings.OverrideEqualsButNotHashcode(someClass));
             }
         }
     }
@@ -2154,8 +2157,8 @@
             MethodSymbol undef1 =
                 new MethodSymbol(undef.flags(), undef.name,
                                  types.memberType(c.type, undef), undef.owner);
-            log.error(pos, "does.not.override.abstract",
-                      c, undef1, undef1.location());
+            log.error(pos,
+                      Errors.DoesNotOverrideAbstract(c, undef1, undef1.location()));
         }
     }
 
@@ -2288,7 +2291,7 @@
         if (seen.contains(t)) {
             tv = (TypeVar)t;
             tv.bound = types.createErrorType(t);
-            log.error(pos, "cyclic.inheritance", t);
+            log.error(pos, Errors.CyclicInheritance(t));
         } else if (t.hasTag(TYPEVAR)) {
             tv = (TypeVar)t;
             seen = seen.prepend(tv);
@@ -2340,7 +2343,7 @@
 
     /** Note that we found an inheritance cycle. */
     private void noteCyclic(DiagnosticPosition pos, ClassSymbol c) {
-        log.error(pos, "cyclic.inheritance", c);
+        log.error(pos, Errors.CyclicInheritance(c));
         for (List<Type> l=types.interfaces(c.type); l.nonEmpty(); l=l.tail)
             l.head = types.createErrorType((ClassSymbol)l.head.tsym, Type.noType);
         Type st = types.supertype(c.type);
@@ -2509,9 +2512,7 @@
             if (!types.isSubSignature(sym.type, types.memberType(site, s), allowStrictMethodClashCheck)) {
                 if (types.hasSameArgs(s.erasure(types), sym.erasure(types))) {
                     log.error(pos,
-                            "name.clash.same.erasure.no.hide",
-                            sym, sym.location(),
-                            s, s.location());
+                              Errors.NameClashSameErasureNoHide(sym, sym.location(), s, s.location()));
                     return;
                 } else {
                     checkPotentiallyAmbiguousOverloads(pos, site, sym, (MethodSymbol)s);
@@ -2647,9 +2648,9 @@
                 //this means a call site passing an implicit lambda would be ambigiuous
                 msym1.flags_field |= POTENTIALLY_AMBIGUOUS;
                 msym2.flags_field |= POTENTIALLY_AMBIGUOUS;
-                log.warning(LintCategory.OVERLOADS, pos, "potentially.ambiguous.overload",
-                            msym1, msym1.location(),
-                            msym2, msym2.location());
+                log.warning(LintCategory.OVERLOADS, pos,
+                            Warnings.PotentiallyAmbiguousOverload(msym1, msym1.location(),
+                                                                  msym2, msym2.location()));
                 return;
             }
         }
@@ -2679,11 +2680,11 @@
                 if (isLambda) {
                     if (belongsToRestrictedPackage(sym)) {
                         log.warning(LintCategory.SERIAL, tree.pos(),
-                            "access.to.member.from.serializable.lambda", sym);
+                                    Warnings.AccessToMemberFromSerializableLambda(sym));
                     }
                 } else {
                     log.warning(tree.pos(),
-                        "access.to.member.from.serializable.element", sym);
+                                Warnings.AccessToMemberFromSerializableElement(sym));
                 }
             }
         }
@@ -2715,7 +2716,7 @@
      */
     private void syntheticError(DiagnosticPosition pos, Symbol sym) {
         if (!sym.type.isErroneous()) {
-            log.error(pos, "synthetic.name.conflict", sym, sym.location());
+            log.error(pos, Errors.SyntheticNameConflict(sym, sym.location()));
         }
     }
 
@@ -2743,9 +2744,10 @@
                     List<Type> oldparams = oldit.allparams();
                     List<Type> newparams = it.allparams();
                     if (!types.containsTypeEquivalent(oldparams, newparams))
-                        log.error(pos, "cant.inherit.diff.arg",
-                                  it.tsym, Type.toString(oldparams),
-                                  Type.toString(newparams));
+                        log.error(pos,
+                                  Errors.CantInheritDiffArg(it.tsym,
+                                                            Type.toString(oldparams),
+                                                            Type.toString(newparams)));
                 }
                 checkClassBounds(pos, seensofar, it);
             }
@@ -2758,7 +2760,7 @@
      */
     void checkNotRepeated(DiagnosticPosition pos, Type it, Set<Type> its) {
         if (its.contains(it))
-            log.error(pos, "repeated.interface");
+            log.error(pos, Errors.RepeatedInterface);
         else {
             its.add(it);
         }
@@ -2808,7 +2810,7 @@
             validateAnnotationType(pos, types.elemtype(type));
             return;
         }
-        log.error(pos, "invalid.annotation.member.type");
+        log.error(pos, Errors.InvalidAnnotationMemberType);
     }
 
     /**
@@ -2826,7 +2828,7 @@
                 if (sym.kind == MTH &&
                     (sym.flags() & (PUBLIC | PROTECTED)) != 0 &&
                     types.overrideEquivalent(m.type, sym.type))
-                    log.error(pos, "intf.annotation.member.clash", sym, sup);
+                    log.error(pos, Errors.IntfAnnotationMemberClash(sym, sup));
             }
         }
     }
@@ -2851,13 +2853,13 @@
         validateAnnotationTree(a);
 
         if (a.type.tsym.isAnnotationType() && !annotationApplicable(a, s))
-            log.error(a.pos(), "annotation.type.not.applicable");
+            log.error(a.pos(), Errors.AnnotationTypeNotApplicable);
 
         if (a.annotationType.type.tsym == syms.functionalInterfaceType.tsym) {
             if (s.kind != TYP) {
-                log.error(a.pos(), "bad.functional.intf.anno");
+                log.error(a.pos(), Errors.BadFunctionalIntfAnno);
             } else if (!s.isInterface() || (s.flags() & ANNOTATION) != 0) {
-                log.error(a.pos(), "bad.functional.intf.anno.1", diags.fragment("not.a.functional.intf", s));
+                log.error(a.pos(), Errors.BadFunctionalIntfAnno1(Fragments.NotAFunctionalIntf(s)));
             }
         }
     }
@@ -2911,11 +2913,13 @@
             MethodSymbol m = (MethodSymbol) sym;
             Type ret = m.getReturnType();
             if (!(ret.hasTag(ARRAY) && types.isSameType(((ArrayType)ret).elemtype, contained.type))) {
-                log.error(pos, "invalid.repeatable.annotation.value.return",
-                        container, ret, types.makeArrayType(contained.type));
+                log.error(pos,
+                          Errors.InvalidRepeatableAnnotationValueReturn(container,
+                                                                        ret,
+                                                                        types.makeArrayType(contained.type)));
             }
         } else {
-            log.error(pos, "invalid.repeatable.annotation.no.value", container);
+            log.error(pos, Errors.InvalidRepeatableAnnotationNoValue(container));
         }
     }
 
@@ -2936,16 +2940,18 @@
             }
         }
         if (error ) {
-            log.error(pos, "invalid.repeatable.annotation.retention",
-                      container, containerRetention,
-                      contained, containedRetention);
+            log.error(pos,
+                      Errors.InvalidRepeatableAnnotationRetention(container,
+                                                                  containerRetention.name(),
+                                                                  contained,
+                                                                  containedRetention.name()));
         }
     }
 
     private void validateDocumented(Symbol container, Symbol contained, DiagnosticPosition pos) {
         if (contained.attribute(syms.documentedType.tsym) != null) {
             if (container.attribute(syms.documentedType.tsym) == null) {
-                log.error(pos, "invalid.repeatable.annotation.not.documented", container, contained);
+                log.error(pos, Errors.InvalidRepeatableAnnotationNotDocumented(container, contained));
             }
         }
     }
@@ -2953,7 +2959,7 @@
     private void validateInherited(Symbol container, Symbol contained, DiagnosticPosition pos) {
         if (contained.attribute(syms.inheritedType.tsym) != null) {
             if (container.attribute(syms.inheritedType.tsym) == null) {
-                log.error(pos, "invalid.repeatable.annotation.not.inherited", container, contained);
+                log.error(pos, Errors.InvalidRepeatableAnnotationNotInherited(container, contained));
             }
         }
     }
@@ -2995,7 +3001,7 @@
         }
 
         if (!isTargetSubsetOf(containerTargets, containedTargets)) {
-            log.error(pos, "invalid.repeatable.annotation.incompatible.target", container, contained);
+            log.error(pos, Errors.InvalidRepeatableAnnotationIncompatibleTarget(container, contained));
         }
     }
 
@@ -3058,9 +3064,7 @@
                 elm.kind == MTH &&
                 ((MethodSymbol)elm).defaultValue == null) {
                 log.error(pos,
-                          "invalid.repeatable.annotation.elem.nondefault",
-                          container,
-                          elm);
+                          Errors.InvalidRepeatableAnnotationElemNondefault(container, elm));
             }
         }
     }
@@ -3209,8 +3213,8 @@
             if (m == null || m.type.isErroneous()) continue;
             if (!elements.remove(m)) {
                 isValid = false;
-                log.error(assign.lhs.pos(), "duplicate.annotation.member.value",
-                        m.name, a.type);
+                log.error(assign.lhs.pos(),
+                          Errors.DuplicateAnnotationMemberValue(m.name, a.type));
             }
         }
 
@@ -3256,7 +3260,7 @@
         for (JCTree elem : na.elems) {
             if (!targets.add(TreeInfo.symbol(elem))) {
                 isValid = false;
-                log.error(elem.pos(), "repeated.annotation.target");
+                log.error(elem.pos(), Errors.RepeatedAnnotationTarget);
             }
         }
         return isValid;
@@ -3268,13 +3272,13 @@
             !syms.deprecatedType.isErroneous() &&
             s.attribute(syms.deprecatedType.tsym) == null) {
             log.warning(LintCategory.DEP_ANN,
-                    pos, "missing.deprecated.annotation");
+                    pos, Warnings.MissingDeprecatedAnnotation);
         }
         // Note: @Deprecated has no effect on local variables, parameters and package decls.
         if (lint.isEnabled(LintCategory.DEPRECATION) && !s.isDeprecatableViaAnnotation()) {
             if (!syms.deprecatedType.isErroneous() && s.attribute(syms.deprecatedType.tsym) != null) {
                 log.warning(LintCategory.DEPRECATION, pos,
-                        "deprecated.annotation.has.no.effect", Kinds.kindName(s));
+                            Warnings.DeprecatedAnnotationHasNoEffect(Kinds.kindName(s)));
             }
         }
     }
@@ -3290,14 +3294,14 @@
     void checkSunAPI(final DiagnosticPosition pos, final Symbol s) {
         if ((s.flags() & PROPRIETARY) != 0) {
             deferredLintHandler.report(() -> {
-                log.mandatoryWarning(pos, "sun.proprietary", s);
+                log.mandatoryWarning(pos, Warnings.SunProprietary(s));
             });
         }
     }
 
     void checkProfile(final DiagnosticPosition pos, final Symbol s) {
         if (profile != Profile.DEFAULT && (s.flags() & NOT_IN_PROFILE) != 0) {
-            log.error(pos, "not.in.profile", s, profile);
+            log.error(pos, Errors.NotInProfile(s, profile));
         }
     }
 
@@ -3327,7 +3331,7 @@
         if ((tsym.flags_field & ACYCLIC_ANN) != 0)
             return;
         if ((tsym.flags_field & LOCKED) != 0) {
-            log.error(pos, "cyclic.annotation.element");
+            log.error(pos, Errors.CyclicAnnotationElement(tsym));
             return;
         }
         try {
@@ -3395,7 +3399,7 @@
         if (ctor != null && (ctor.flags_field & ACYCLIC) == 0) {
             if ((ctor.flags_field & LOCKED) != 0) {
                 log.error(TreeInfo.diagnosticPositionFor(ctor, tree),
-                          "recursive.ctor.invocation");
+                          Errors.RecursiveCtorInvocation);
             } else {
                 ctor.flags_field |= LOCKED;
                 checkCyclicConstructor(tree, callMap.remove(ctor), callMap);
@@ -3433,7 +3437,7 @@
     void checkEmptyIf(JCIf tree) {
         if (tree.thenpart.hasTag(SKIP) && tree.elsepart == null &&
                 lint.isEnabled(LintCategory.EMPTY))
-            log.warning(LintCategory.EMPTY, tree.thenpart.pos(), "empty.if");
+            log.warning(LintCategory.EMPTY, tree.thenpart.pos(), Warnings.EmptyIf);
     }
 
     /** Check that symbol is unique in given scope.
@@ -3473,7 +3477,7 @@
      */
     void duplicateErasureError(DiagnosticPosition pos, Symbol sym1, Symbol sym2) {
         if (!sym1.type.isErroneous() && !sym2.type.isErroneous()) {
-            log.error(pos, "name.clash.same.erasure", sym1, sym2);
+            log.error(pos, Errors.NameClashSameErasure(sym1, sym2));
         }
     }
 
@@ -3531,14 +3535,14 @@
         }
         if (clashing != null) {
             if (staticImport)
-                log.error(pos, "already.defined.static.single.import", clashing);
+                log.error(pos, Errors.AlreadyDefinedStaticSingleImport(clashing));
             else
-                log.error(pos, "already.defined.single.import", clashing);
+                log.error(pos, Errors.AlreadyDefinedSingleImport(clashing));
             return false;
         }
         clashing = topLevelScope.findFirst(sym.name, duplicates);
         if (clashing != null) {
-            log.error(pos, "already.defined.this.unit", clashing);
+            log.error(pos, Errors.AlreadyDefinedThisUnit(clashing));
             return false;
         }
         return true;
@@ -3548,8 +3552,8 @@
      */
     public void checkCanonical(JCTree tree) {
         if (!isCanonical(tree))
-            log.error(tree.pos(), "import.requires.canonical",
-                      TreeInfo.symbol(tree));
+            log.error(tree.pos(),
+                      Errors.ImportRequiresCanonical(TreeInfo.symbol(tree)));
     }
         // where
         private boolean isCanonical(JCTree tree) {
@@ -3570,8 +3574,8 @@
             rs.isAccessible(env, c) &&
             !fileManager.isSameFile(c.sourcefile, env.toplevel.sourcefile))
         {
-            log.warning(pos, "auxiliary.class.accessed.from.outside.of.its.source.file",
-                        c, c.sourcefile);
+            log.warning(pos,
+                        Warnings.AuxiliaryClassAccessedFromOutsideOfItsSourceFile(c, c.sourcefile));
         }
     }
 
@@ -3631,7 +3635,7 @@
                         break;
                     }
                 }
-                log.error(pos, "bad.functional.intf.anno.1", ex.getDiagnostic());
+                log.error(pos, Errors.BadFunctionalIntfAnno1(ex.getDiagnostic()));
             }
         }
     }
@@ -3647,11 +3651,14 @@
 
             TypeSymbol site = (TypeSymbol) TreeInfo.symbol(select.selected);
             if (!checkTypeContainsImportableElement(site, site, toplevel.packge, select.name, new HashSet<Symbol>())) {
-                log.error(imp.pos(), "cant.resolve.location",
-                          KindName.STATIC,
-                          select.name, List.<Type>nil(), List.<Type>nil(),
-                          Kinds.typeKindName(TreeInfo.symbol(select.selected).type),
-                          TreeInfo.symbol(select.selected).type);
+                log.error(imp.pos(),
+                          Errors.CantResolveLocation(KindName.STATIC,
+                                                     select.name,
+                                                     null,
+                                                     null,
+                                                     Fragments.Location(kindName(site),
+                                                                        site,
+                                                                        null)));
             }
         }
     }
@@ -3672,7 +3679,7 @@
                     }
                 }
                 if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) {
-                    log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, "doesnt.exist", tsym);
+                    log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, Errors.DoesntExist(tsym));
                 }
             }
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Jun 15 13:44:42 2017 +0200
@@ -41,6 +41,7 @@
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.Attr.ResultInfo;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 import com.sun.tools.javac.util.Log.DeferredDiagnosticHandler;
@@ -811,7 +812,7 @@
 
                     if (descriptorType.getParameterTypes().length() != tree.params.length()) {
                         checkContext.report(tree,
-                                diags.fragment("incompatible.arg.types.in.lambda"));
+                                diags.fragment(Fragments.IncompatibleArgTypesInLambda));
                     }
 
                     Type currentReturnType = descriptorType.getReturnType();
@@ -821,8 +822,7 @@
                             TreeInfo.isExpressionStatement((JCExpression)tree.getBody());
                         if (!isExpressionCompatible) {
                             resultInfo.checkContext.report(tree.pos(),
-                                diags.fragment("incompatible.ret.type.in.lambda",
-                                    diags.fragment("missing.ret.val", currentReturnType)));
+                                diags.fragment(Fragments.IncompatibleRetTypeInLambda(Fragments.MissingRetVal(currentReturnType))));
                         }
                     } else {
                         LambdaBodyStructChecker lambdaBodyChecker =
@@ -834,20 +834,19 @@
                         if (returnTypeIsVoid) {
                             if (!isVoidCompatible) {
                                 resultInfo.checkContext.report(tree.pos(),
-                                    diags.fragment("unexpected.ret.val"));
+                                    diags.fragment(Fragments.UnexpectedRetVal));
                             }
                         } else {
                             boolean isValueCompatible = lambdaBodyChecker.isPotentiallyValueCompatible
                                 && !canLambdaBodyCompleteNormally(tree);
                             if (!isValueCompatible && !isVoidCompatible) {
                                 log.error(tree.body.pos(),
-                                    "lambda.body.neither.value.nor.void.compatible");
+                                          Errors.LambdaBodyNeitherValueNorVoidCompatible);
                             }
 
                             if (!isValueCompatible) {
                                 resultInfo.checkContext.report(tree.pos(),
-                                    diags.fragment("incompatible.ret.type.in.lambda",
-                                        diags.fragment("missing.ret.val", currentReturnType)));
+                                    diags.fragment(Fragments.IncompatibleRetTypeInLambda(Fragments.MissingRetVal(currentReturnType))));
                             }
                         }
                     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Thu Jun 15 13:44:42 2017 +0200
@@ -39,6 +39,7 @@
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.main.Option.PkgInfo;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
@@ -332,7 +333,7 @@
                         addEnv = true;
                     } else if (pd.annotations.nonEmpty()) {
                         log.error(pd.annotations.head.pos(),
-                                  "pkg.annotations.sb.in.package-info.java");
+                                  Errors.PkgAnnotationsSbInPackageInfoJava);
                     }
                 }
             } else {
@@ -363,8 +364,7 @@
                     JCCompilationUnit tree0 = env0.toplevel;
                     if (!fileManager.isSameFile(tree.sourcefile, tree0.sourcefile)) {
                         log.warning(pd != null ? pd.pid.pos() : null,
-                                    "pkg-info.already.seen",
-                                    tree.packge);
+                                    Warnings.PkgInfoAlreadySeen(tree.packge));
                     }
                 }
                 typeEnvs.put(tree.packge, packageEnv);
@@ -409,7 +409,7 @@
                     topElement = KindName.INTERFACE;
                 }
                 log.error(tree.pos(),
-                          "class.public.should.be.in.file", topElement, tree.name);
+                          Errors.ClassPublicShouldBeInFile(topElement, tree.name));
             }
         } else {
             if (!tree.name.isEmpty() &&
@@ -512,7 +512,7 @@
 
     /** Complain about a duplicate class. */
     protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {
-        log.error(pos, "duplicate.class", c.fullname);
+        log.error(pos, Errors.DuplicateClass(c.fullname));
     }
 
     /** Class enter visitor method for type parameters.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Jun 15 13:44:42 2017 +0200
@@ -32,6 +32,8 @@
 import com.sun.source.tree.LambdaExpressionTree.BodyKind;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Scope.WriteableScope;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -427,7 +429,7 @@
             scanStat(tree);
             if (tree != null && tree.hasTag(JCTree.Tag.BLOCK) && !alive) {
                 log.error(tree.pos(),
-                          "initializer.must.be.able.to.complete.normally");
+                          Errors.InitializerMustBeAbleToCompleteNormally);
             }
         }
 
@@ -435,7 +437,7 @@
          */
         void scanStat(JCTree tree) {
             if (!alive && tree != null) {
-                log.error(tree.pos(), "unreachable.stmt");
+                log.error(tree.pos(), Errors.UnreachableStmt);
                 if (!tree.hasTag(SKIP)) alive = true;
             }
             scan(tree);
@@ -503,7 +505,7 @@
                 scanStat(tree.body);
 
                 if (alive && !tree.sym.type.getReturnType().hasTag(VOID))
-                    log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt");
+                    log.error(TreeInfo.diagEndPos(tree.body), Errors.MissingRetStmt);
 
                 List<PendingExit> exits = pendingExits.toList();
                 pendingExits = new ListBuffer<>();
@@ -608,7 +610,7 @@
                     c.stats.nonEmpty() && l.tail.nonEmpty())
                     log.warning(Lint.LintCategory.FALLTHROUGH,
                                 l.tail.head.pos(),
-                                "possible.fall-through.into.case");
+                                Warnings.PossibleFallThroughIntoCase);
             }
             if (!hasDefault) {
                 alive = true;
@@ -650,7 +652,7 @@
                     if (lint.isEnabled(Lint.LintCategory.FINALLY)) {
                         log.warning(Lint.LintCategory.FINALLY,
                                 TreeInfo.diagEndPos(tree.finalizer),
-                                "finally.cannot.complete");
+                                Warnings.FinallyCannotComplete);
                     }
                 } else {
                     while (exits.nonEmpty()) {
@@ -811,18 +813,15 @@
                 if (classDef != null &&
                     classDef.pos == exit.tree.pos) {
                     log.error(exit.tree.pos(),
-                            "unreported.exception.default.constructor",
-                            exit.thrown);
+                              Errors.UnreportedExceptionDefaultConstructor(exit.thrown));
                 } else if (exit.tree.hasTag(VARDEF) &&
                         ((JCVariableDecl)exit.tree).sym.isResourceVariable()) {
                     log.error(exit.tree.pos(),
-                            "unreported.exception.implicit.close",
-                            exit.thrown,
-                            ((JCVariableDecl)exit.tree).sym.name);
+                              Errors.UnreportedExceptionImplicitClose(exit.thrown,
+                                                                      ((JCVariableDecl)exit.tree).sym.name));
                 } else {
                     log.error(exit.tree.pos(),
-                            "unreported.exception.need.to.catch.or.throw",
-                            exit.thrown);
+                              Errors.UnreportedExceptionNeedToCatchOrThrow(exit.thrown));
                 }
             }
         }
@@ -1170,11 +1169,11 @@
 
         void checkCaughtType(DiagnosticPosition pos, Type exc, List<Type> thrownInTry, List<Type> caughtInTry) {
             if (chk.subset(exc, caughtInTry)) {
-                log.error(pos, "except.already.caught", exc);
+                log.error(pos, Errors.ExceptAlreadyCaught(exc));
             } else if (!chk.isUnchecked(pos, exc) &&
                     !isExceptionOrThrowable(exc) &&
                     !chk.intersects(exc, thrownInTry)) {
-                log.error(pos, "except.never.thrown.in.try", exc);
+                log.error(pos, Errors.ExceptNeverThrownInTry(exc));
             } else if (allowImprovedCatchAnalysis) {
                 List<Type> catchableThrownTypes = chk.intersect(List.of(exc), thrownInTry);
                 // 'catchableThrownTypes' cannnot possibly be empty - if 'exc' was an
@@ -1610,11 +1609,11 @@
                 else if ((sym.flags() & FINAL) != 0) {
                     if ((sym.flags() & PARAMETER) != 0) {
                         if ((sym.flags() & UNION) != 0) { //multi-catch parameter
-                            log.error(pos, "multicatch.parameter.may.not.be.assigned", sym);
+                            log.error(pos, Errors.MulticatchParameterMayNotBeAssigned(sym));
                         }
                         else {
-                            log.error(pos, "final.parameter.may.not.be.assigned",
-                                  sym);
+                            log.error(pos,
+                                      Errors.FinalParameterMayNotBeAssigned(sym));
                         }
                     } else if (!uninits.isMember(sym.adr)) {
                         log.error(pos, flowKind.errKey, sym);
@@ -1624,7 +1623,7 @@
                 }
                 inits.incl(sym.adr);
             } else if ((sym.flags() & FINAL) != 0) {
-                log.error(pos, "var.might.already.be.assigned", sym);
+                log.error(pos, Errors.VarMightAlreadyBeAssigned(sym));
             }
         }
         //where
@@ -2190,7 +2189,7 @@
                 for (JCVariableDecl resVar : resourceVarDecls) {
                     if (unrefdResources.includes(resVar.sym)) {
                         log.warning(Lint.LintCategory.TRY, resVar.pos(),
-                                    "try.resource.not.referenced", resVar.sym);
+                                    Warnings.TryResourceNotReferenced(resVar.sym));
                         unrefdResources.remove(resVar.sym);
                     }
                 }
@@ -2601,13 +2600,12 @@
         void reportEffectivelyFinalError(DiagnosticPosition pos, Symbol sym) {
             String subKey = currentTree.hasTag(LAMBDA) ?
                   "lambda"  : "inner.cls";
-            log.error(pos, "cant.ref.non.effectively.final.var", sym, diags.fragment(subKey));
+            log.error(pos, Errors.CantRefNonEffectivelyFinalVar(sym, diags.fragment(subKey)));
         }
 
         void reportInnerClsNeedsFinalError(DiagnosticPosition pos, Symbol sym) {
             log.error(pos,
-                    "local.var.accessed.from.icls.needs.final",
-                    sym);
+                      Errors.LocalVarAccessedFromIclsNeedsFinal(sym));
         }
 
     /*************************************************************************
@@ -2676,7 +2674,7 @@
                 if (!resource.hasTag(VARDEF)) {
                     Symbol var = TreeInfo.symbol(resource);
                     if (var != null && (var.flags() & (FINAL | EFFECTIVELY_FINAL)) == 0) {
-                        log.error(resource.pos(), "try.with.resources.expr.effectively.final.var", var);
+                        log.error(resource.pos(), Errors.TryWithResourcesExprEffectivelyFinalVar(var));
                     }
                 }
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jun 15 13:44:42 2017 +0200
@@ -28,6 +28,8 @@
 import com.sun.tools.javac.code.Type.UndetVar.UndetVarListener;
 import com.sun.tools.javac.code.Types.TypeMapping;
 import com.sun.tools.javac.comp.Attr.CheckMode;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
+import com.sun.tools.javac.resources.CompilerProperties.Notes;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCTypeCast;
 import com.sun.tools.javac.tree.TreeInfo;
@@ -238,7 +240,7 @@
             }
 
             if (resultInfo != null && rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
-                log.note(env.tree.pos, "deferred.method.inst", msym, mt, resultInfo.pt);
+                log.note(env.tree.pos, Notes.DeferredMethodInst(msym, mt, resultInfo.pt));
             }
 
             // return instantiated version of method type
@@ -665,12 +667,12 @@
             //in the functional interface descriptors)
             List<Type> descParameterTypes = types.findDescriptorType(formalInterface).getParameterTypes();
             if (descParameterTypes.size() != paramTypes.size()) {
-                checkContext.report(pos, diags.fragment("incompatible.arg.types.in.lambda"));
+                checkContext.report(pos, diags.fragment(Fragments.IncompatibleArgTypesInLambda));
                 return types.createErrorType(funcInterface);
             }
             for (Type p : descParameterTypes) {
                 if (!types.isSameType(funcInterfaceContext.asUndetVar(p), paramTypes.head)) {
-                    checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+                    checkContext.report(pos, diags.fragment(Fragments.NoSuitableFunctionalIntfInst(funcInterface)));
                     return types.createErrorType(funcInterface);
                 }
                 paramTypes = paramTypes.tail;
@@ -689,7 +691,7 @@
             if (!chk.checkValidGenericType(owntype)) {
                 //if the inferred functional interface type is not well-formed,
                 //or if it's not a subtype of the original target, issue an error
-                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+                checkContext.report(pos, diags.fragment(Fragments.NoSuitableFunctionalIntfInst(funcInterface)));
             }
             //propagate constraints as per JLS 18.2.1
             checkContext.compatible(owntype, funcInterface, types.noWarnings);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Jun 15 13:44:42 2017 +0200
@@ -45,6 +45,7 @@
 import com.sun.tools.javac.code.Types;
 import com.sun.tools.javac.comp.LambdaToMethod.LambdaAnalyzerPreprocessor.*;
 import com.sun.tools.javac.comp.Lower.BasicFreeVarCollector;
+import com.sun.tools.javac.resources.CompilerProperties.Notes;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -1497,7 +1498,7 @@
             } else {
                 super.visitReference(tree);
                 if (dumpLambdaToMethodStats) {
-                    log.note(tree, "mref.stat", rcontext.needsAltMetafactory(), null);
+                    log.note(tree, Notes.MrefStat(rcontext.needsAltMetafactory(), null));
                 }
             }
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Jun 15 13:44:42 2017 +0200
@@ -39,6 +39,7 @@
 
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.code.Type.*;
 
@@ -1760,7 +1761,7 @@
     JCExpression makeOuterThis(DiagnosticPosition pos, TypeSymbol c) {
         List<VarSymbol> ots = outerThisStack;
         if (ots.isEmpty()) {
-            log.error(pos, "no.encl.instance.of.type.in.scope", c);
+            log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
             Assert.error();
             return makeNull();
         }
@@ -1771,9 +1772,7 @@
             do {
                 ots = ots.tail;
                 if (ots.isEmpty()) {
-                    log.error(pos,
-                              "no.encl.instance.of.type.in.scope",
-                              c);
+                    log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
                     Assert.error(); // should have been caught in Attr
                     return tree;
                 }
@@ -1818,7 +1817,7 @@
         Symbol c = sym.owner;
         List<VarSymbol> ots = outerThisStack;
         if (ots.isEmpty()) {
-            log.error(pos, "no.encl.instance.of.type.in.scope", c);
+            log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
             Assert.error();
             return makeNull();
         }
@@ -1829,9 +1828,7 @@
             do {
                 ots = ots.tail;
                 if (ots.isEmpty()) {
-                    log.error(pos,
-                        "no.encl.instance.of.type.in.scope",
-                        c);
+                    log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
                     Assert.error();
                     return tree;
                 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Jun 15 13:44:42 2017 +0200
@@ -36,6 +36,7 @@
 
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -320,7 +321,7 @@
                 checkType(tree.vartype, outertype, "incorrect.constructor.receiver.type");
                 checkType(tree.nameexpr, outertype, "incorrect.constructor.receiver.name");
             } else {
-                log.error(tree, "receiver.parameter.not.applicable.constructor.toplevel.class");
+                log.error(tree, Errors.ReceiverParameterNotApplicableConstructorToplevelClass);
             }
         } else {
             checkType(tree.vartype, m.owner.type, "incorrect.receiver.type");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Thu Jun 15 13:44:42 2017 +0200
@@ -276,7 +276,7 @@
                 msym.complete();
             }
         } catch (CompletionFailure ex) {
-            log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, Position.NOPOS, "cant.access", ex.sym, ex.getDetailValue());
+            log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, Position.NOPOS, Errors.CantAccess(ex.sym, ex.getDetailValue()));
             if (ex instanceof ClassFinder.BadClassFile) throw new Abort();
         } finally {
             depth--;
@@ -565,7 +565,7 @@
 
         JavaFileObject prev = log.useSource(tree.sourcefile);
         try {
-            log.error(tree.pos(), "file.sb.on.source.or.patch.path.for.module");
+            log.error(tree.pos(), Errors.FileSbOnSourceOrPatchPathForModule);
         } finally {
             log.useSource(prev);
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jun 15 13:44:42 2017 +0200
@@ -41,6 +41,7 @@
 import com.sun.tools.javac.comp.Resolve.ReferenceLookupResult.StaticKind;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -253,7 +254,7 @@
     JCDiagnostic getVerboseApplicableCandidateDiag(int pos, Symbol sym, Type inst) {
         JCDiagnostic subDiag = null;
         if (sym.type.hasTag(FORALL)) {
-            subDiag = diags.fragment("partial.inst.sig", inst);
+            subDiag = diags.fragment(Fragments.PartialInstSig(inst));
         }
 
         String key = subDiag == null ?
@@ -264,7 +265,7 @@
     }
 
     JCDiagnostic getVerboseInapplicableCandidateDiag(int pos, Symbol sym, JCDiagnostic subDiag) {
-        return diags.fragment("not.applicable.method.found", pos, sym, subDiag);
+        return diags.fragment(Fragments.NotApplicableMethodFound(pos, sym, subDiag));
     }
     // </editor-fold>
 
@@ -1452,8 +1453,7 @@
         Symbol sym = findField(env, site, name, site.tsym);
         if (sym.kind == VAR) return (VarSymbol)sym;
         else throw new FatalError(
-                 diags.fragment("fatal.err.cant.locate.field",
-                                name));
+                 diags.fragment(Fragments.FatalErrCantLocateField(name)));
     }
 
     /** Find unqualified variable or field with given name.
@@ -2545,8 +2545,8 @@
      */
     void checkNonAbstract(DiagnosticPosition pos, Symbol sym) {
         if ((sym.flags() & ABSTRACT) != 0 && (sym.flags() & DEFAULT) == 0)
-            log.error(pos, "abstract.cant.be.accessed.directly",
-                      kindName(sym), sym, sym.location());
+            log.error(pos,
+                      Errors.AbstractCantBeAccessedDirectly(kindName(sym),sym, sym.location()));
     }
 
 /* ***************************************************************************
@@ -2693,8 +2693,7 @@
                 site, name, argtypes, typeargtypes);
         if (sym.kind == MTH) return (MethodSymbol)sym;
         else throw new FatalError(
-                 diags.fragment("fatal.err.cant.locate.meth",
-                                name));
+                 diags.fragment(Fragments.FatalErrCantLocateMeth(name)));
     }
 
     /** Resolve constructor.
@@ -2746,7 +2745,7 @@
         Symbol sym = resolveConstructor(resolveContext, pos, env, site, argtypes, typeargtypes);
         if (sym.kind == MTH) return (MethodSymbol)sym;
         else throw new FatalError(
-                 diags.fragment("fatal.err.cant.locate.ctor", site));
+                 diags.fragment(Fragments.FatalErrCantLocateCtor(site)));
     }
 
     Symbol findConstructor(DiagnosticPosition pos, Env<AttrContext> env,
@@ -3531,14 +3530,15 @@
             //find a direct super type that is a subtype of 'c'
             for (Type i : types.directSupertypes(env.enclClass.type)) {
                 if (i.tsym.isSubClass(c, types) && i.tsym != c) {
-                    log.error(pos, "illegal.default.super.call", c,
-                            diags.fragment("redundant.supertype", c, i));
+                    log.error(pos,
+                              Errors.IllegalDefaultSuperCall(c,
+                                                             Fragments.RedundantSupertype(c, i)));
                     return syms.errSymbol;
                 }
             }
             Assert.error();
         }
-        log.error(pos, "not.encl.class", c);
+        log.error(pos, Errors.NotEnclClass(c));
         return syms.errSymbol;
     }
     //where
@@ -3572,7 +3572,7 @@
                                  boolean isSuperCall) {
         Symbol sym = resolveSelfContainingInternal(env, member, isSuperCall);
         if (sym == null) {
-            log.error(pos, "encl.class.required", member);
+            log.error(pos, Errors.EnclClassRequired(member));
             return syms.errSymbol;
         } else {
             return accessBase(sym, pos, env.enclClass.sym.type, sym.name, true);
@@ -3623,8 +3623,9 @@
         Type thisType = (t.tsym.owner.kind.matches(KindSelector.VAL_MTH)
                          ? resolveSelf(pos, env, t.getEnclosingType().tsym, names._this)
                          : resolveSelfContaining(pos, env, t.tsym, isSuperCall)).type;
-        if (env.info.isSelfCall && thisType.tsym == env.enclClass.sym)
-            log.error(pos, "cant.ref.before.ctor.called", "this");
+        if (env.info.isSelfCall && thisType.tsym == env.enclClass.sym) {
+            log.error(pos, Errors.CantRefBeforeCtorCalled("this"));
+        }
         return thisType;
     }
 
@@ -3847,15 +3848,13 @@
         }
         private JCDiagnostic getLocationDiag(Symbol location, Type site) {
             if (location.kind == VAR) {
-                return diags.fragment("location.1",
-                    kindName(location),
-                    location,
-                    location.type);
+                return diags.fragment(Fragments.Location1(kindName(location),
+                                                          location,
+                                                          location.type));
             } else {
-                return diags.fragment("location",
-                    typeKindName(site),
-                    site,
-                    null);
+                return diags.fragment(Fragments.Location(typeKindName(site),
+                                      site,
+                                      null));
             }
         }
     }
@@ -4019,11 +4018,11 @@
                 List<JCDiagnostic> details = List.nil();
                 for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) {
                     Symbol sym = _entry.getKey();
-                    JCDiagnostic detailDiag = diags.fragment("inapplicable.method",
-                            Kinds.kindName(sym),
-                            sym.location(site, types),
-                            sym.asMemberOf(site, types),
-                            _entry.getValue());
+                    JCDiagnostic detailDiag =
+                            diags.fragment(Fragments.InapplicableMethod(Kinds.kindName(sym),
+                                                                        sym.location(site, types),
+                                                                        sym.asMemberOf(site, types),
+                                                                        _entry.getValue()));
                     details = details.prepend(detailDiag);
                 }
                 //typically members are visited in reverse order (see Scope)
@@ -4067,7 +4066,7 @@
                 "cant.apply.diamond" :
                 "cant.apply.diamond.1";
             return diags.create(dkind, log.currentSource(), pos, key,
-                    diags.fragment("diamond", site.tsym), details);
+                    Fragments.Diamond(site.tsym), details);
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Jun 15 13:44:42 2017 +0200
@@ -541,8 +541,7 @@
             if (sym != tree.sym &&
                 types.isSameType(erasure(sym.type), tree.type)) {
                 log.error(tree.pos(),
-                          "name.clash.same.erasure", tree.sym,
-                          sym);
+                          Errors.NameClashSameErasure(tree.sym, sym));
                 return;
             }
         }
@@ -683,8 +682,8 @@
         else
             if (tree.args.length() != argtypes.length()) {
                 log.error(tree.pos(),
-                              "method.invoked.with.incorrect.number.arguments",
-                              tree.args.length(), argtypes.length());
+                          Errors.MethodInvokedWithIncorrectNumberArguments(tree.args.length(),
+                                                                           argtypes.length()));
             }
         tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Jun 15 13:44:42 2017 +0200
@@ -44,6 +44,7 @@
 
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -52,6 +53,7 @@
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.ERROR;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 import com.sun.tools.javac.util.Dependencies.CompletionCause;
@@ -339,7 +341,7 @@
                 // Import-on-demand java.lang.
                 PackageSymbol javaLang = syms.enterPackage(syms.java_base, names.java_lang);
                 if (javaLang.members().isEmpty() && !javaLang.exists())
-                    throw new FatalError(diags.fragment("fatal.err.no.java.lang"));
+                    throw new FatalError(diags.fragment(Fragments.FatalErrNoJavaLang));
                 importAll(make.at(tree.pos()).Import(make.QualIdent(javaLang), false), javaLang, env);
 
                 JCModuleDecl decl = tree.getModuleDecl();
@@ -378,8 +380,7 @@
                     PackageSymbol pack = syms.lookupPackage(env.toplevel.modle, p.owner.getQualifiedName());
                     if (syms.getClass(pack.modle, p.getQualifiedName()) != null) {
                         log.error(tree.pos,
-                                  "pkg.clashes.with.class.of.same.name",
-                                  p);
+                                  Errors.PkgClashesWithClassOfSameName(p));
                     }
                     p = p.owner;
                 }
@@ -471,7 +472,7 @@
                                        final Name name,
                                        final Env<AttrContext> env) {
             if (tsym.kind != TYP) {
-                log.error(DiagnosticFlag.RECOVERABLE, imp.pos(), "static.imp.only.classes.and.interfaces");
+                log.error(DiagnosticFlag.RECOVERABLE, imp.pos(), Errors.StaticImpOnlyClassesAndInterfaces);
                 return;
             }
 
@@ -831,7 +832,7 @@
             if (checkClash &&
                 sym.owner.kind == PCK && sym.owner != env.toplevel.modle.unnamedPackage &&
                 syms.packageExists(env.toplevel.modle, sym.fullname)) {
-                log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), sym);
+                log.error(tree.pos, Errors.ClashWithPkgOfSameName(Kinds.kindName(sym),sym));
             }
             if (sym.owner.kind == PCK && (sym.flags_field & PUBLIC) == 0 &&
                 !env.toplevel.sourcefile.isNameCompatible(sym.name.toString(),JavaFileObject.Kind.SOURCE)) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Thu Jun 15 13:44:42 2017 +0200
@@ -311,7 +311,7 @@
         try {
             decoder = getDecoder(encName, ignoreEncodingErrors);
         } catch (IllegalCharsetNameException | UnsupportedCharsetException e) {
-            log.error("unsupported.encoding", encName);
+            log.error(Errors.UnsupportedEncoding(encName));
             return (CharBuffer)CharBuffer.allocate(1).flip();
         }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Jun 15 13:44:42 2017 +0200
@@ -69,6 +69,7 @@
 
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Context.Factory;
@@ -390,7 +391,7 @@
                 }
             } catch (IOException ex) {
                 ex.printStackTrace(System.err);
-                log.error("error.reading.file", userPath, getMessage(ex));
+                log.error(Errors.ErrorReadingFile(userPath, getMessage(ex)));
             }
         }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Thu Jun 15 13:44:42 2017 +0200
@@ -215,7 +215,7 @@
                     entries.add(getPath(s));
                 } catch (IllegalArgumentException e) {
                     if (warn) {
-                        log.warning(LintCategory.PATH, "invalid.path", s);
+                        log.warning(LintCategory.PATH, Warnings.InvalidPath(s));
                     }
                 }
             }
@@ -311,7 +311,7 @@
             if (!Files.isDirectory(dir)) {
                 if (warn) {
                     log.warning(Lint.LintCategory.PATH,
-                            "dir.path.element.not.found", dir);
+                                Warnings.DirPathElementNotFound(dir));
                 }
                 return;
             }
@@ -357,7 +357,7 @@
                 /* No such file or directory exists */
                 if (warn) {
                     log.warning(Lint.LintCategory.PATH,
-                            "path.element.not.found", file);
+                                Warnings.PathElementNotFound(file));
                 }
                 super.add(file);
                 return;
@@ -380,13 +380,13 @@
                             FileSystems.newFileSystem(file, null).close();
                             if (warn) {
                                 log.warning(Lint.LintCategory.PATH,
-                                        "unexpected.archive.file", file);
+                                            Warnings.UnexpectedArchiveFile(file));
                             }
                         } catch (IOException | ProviderNotFoundException e) {
                             // FIXME: include e.getLocalizedMessage in warning
                             if (warn) {
                                 log.warning(Lint.LintCategory.PATH,
-                                        "invalid.archive.file", file);
+                                            Warnings.InvalidArchiveFile(file));
                             }
                             return;
                         }
@@ -419,7 +419,7 @@
                     addFile(f, warn);
                 }
             } catch (IOException e) {
-                log.error("error.reading.file", jarFile, JavacFileManager.getMessage(e));
+                log.error(Errors.ErrorReadingFile(jarFile, JavacFileManager.getMessage(e)));
             }
         }
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/CRTable.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/CRTable.java	Thu Jun 15 13:44:42 2017 +0200
@@ -27,6 +27,7 @@
 
 import java.util.*;
 
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
@@ -173,7 +174,7 @@
                                 ", new_pos = " + new_pos);
          }
          if (new_pos == Position.NOPOS)
-             log.warning(pos, "position.overflow", line);
+             log.warning(pos, Warnings.PositionOverflow(line));
 
         return new_pos;
      }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Jun 15 13:44:42 2017 +0200
@@ -57,6 +57,8 @@
 import com.sun.tools.javac.jvm.ClassFile.NameAndType;
 import com.sun.tools.javac.jvm.ClassFile.Version;
 import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -279,11 +281,11 @@
             diagFactory);
     }
 
-    public ClassFinder.BadEnclosingMethodAttr badEnclosingMethod(Object... args) {
+    public ClassFinder.BadEnclosingMethodAttr badEnclosingMethod(Symbol sym) {
         return new ClassFinder.BadEnclosingMethodAttr (
             currentOwner.enclClass(),
             currentClassFile,
-            diagFactory.fragment("bad.enclosing.method", args),
+            diagFactory.fragment(Fragments.BadEnclosingMethod(sym)),
             diagFactory);
     }
 
@@ -985,8 +987,8 @@
                 if (lintClassfile && !warnedAttrs.contains(name)) {
                     JavaFileObject prev = log.useSource(currentClassFile);
                     try {
-                        log.warning(LintCategory.CLASSFILE, (DiagnosticPosition) null, "future.attr",
-                                name, version.major, version.minor, majorVersion, minorVersion);
+                        log.warning(LintCategory.CLASSFILE, (DiagnosticPosition) null,
+                                    Warnings.FutureAttr(name, version.major, version.minor, majorVersion, minorVersion));
                     } finally {
                         log.useSource(prev);
                     }
@@ -2078,14 +2080,11 @@
             try {
                 if (lintClassfile) {
                     if (failure == null) {
-                        log.warning("annotation.method.not.found",
-                                    container,
-                                    name);
+                        log.warning(Warnings.AnnotationMethodNotFound(container, name));
                     } else {
-                        log.warning("annotation.method.not.found.reason",
-                                    container,
-                                    name,
-                                    failure.getDetailValue());//diagnostic, if present
+                        log.warning(Warnings.AnnotationMethodNotFoundReason(container,
+                                                                            name,
+                                                                            failure.getDetailValue()));//diagnostic, if present
                     }
                 }
             } finally {
@@ -2161,12 +2160,14 @@
             }
             if (enumerator == null) {
                 if (failure != null) {
-                    log.warning("unknown.enum.constant.reason",
-                              currentClassFile, enumTypeSym, proxy.enumerator,
-                              failure.getDiagnostic());
+                    log.warning(Warnings.UnknownEnumConstantReason(currentClassFile,
+                                                                   enumTypeSym,
+                                                                   proxy.enumerator,
+                                                                   failure.getDiagnostic()));
                 } else {
-                    log.warning("unknown.enum.constant",
-                              currentClassFile, enumTypeSym, proxy.enumerator);
+                    log.warning(Warnings.UnknownEnumConstant(currentClassFile,
+                                                             enumTypeSym,
+                                                             proxy.enumerator));
                 }
                 result = new Attribute.Enum(enumTypeSym.type,
                         new VarSymbol(0, proxy.enumerator, syms.botType, enumTypeSym));
@@ -2686,10 +2687,9 @@
             majorVersion * 1000 + minorVersion <
             Version.MIN().major * 1000 + Version.MIN().minor) {
             if (majorVersion == (maxMajor + 1))
-                log.warning("big.major.version",
-                            currentClassFile,
-                            majorVersion,
-                            maxMajor);
+                log.warning(Warnings.BigMajorVersion(currentClassFile,
+                                                     majorVersion,
+                                                     maxMajor));
             else
                 throw badClassFile("wrong.version",
                                    Integer.toString(majorVersion),
@@ -2982,7 +2982,7 @@
                     theRepeatable = deproxy.deproxyCompound(repeatable);
                 }
             } catch (Exception e) {
-                throw new CompletionFailure(sym, e.getMessage());
+                throw new CompletionFailure(sym, ClassReader.this.diagFactory.fragment(Fragments.ExceptionMessage(e.getMessage())));
             }
 
             sym.getAnnotationTypeMetadata().setTarget(theTarget);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Jun 15 13:44:42 2017 +0200
@@ -28,6 +28,7 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Types.UniqueType;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -95,15 +96,15 @@
      */
     public boolean checkLimits(DiagnosticPosition pos, Log log) {
         if (cp > ClassFile.MAX_CODE) {
-            log.error(pos, "limit.code");
+            log.error(pos, Errors.LimitCode);
             return true;
         }
         if (max_locals > ClassFile.MAX_LOCALS) {
-            log.error(pos, "limit.locals");
+            log.error(pos, Errors.LimitLocals);
             return true;
         }
         if (max_stack > ClassFile.MAX_STACK) {
-            log.error(pos, "limit.stack");
+            log.error(pos, Errors.LimitStack);
             return true;
         }
         return false;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jun 15 13:44:42 2017 +0200
@@ -39,6 +39,7 @@
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.jvm.Code.*;
 import com.sun.tools.javac.jvm.Items.*;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.EndPosTable;
 import com.sun.tools.javac.tree.JCTree.*;
 
@@ -270,7 +271,7 @@
             break;
         case ARRAY:
             if (types.dimensions(t) > ClassFile.MAX_DIMENSIONS) {
-                log.error(pos, "limit.dimensions");
+                log.error(pos, Errors.LimitDimensions);
                 nerrs++;
             }
             break;
@@ -517,7 +518,7 @@
             !(constValue instanceof String) ||
             ((String)constValue).length() < Pool.MAX_STRING_LENGTH)
             return;
-        log.error(pos, "limit.string");
+        log.error(pos, Errors.LimitString);
         nerrs++;
     }
 
@@ -888,7 +889,7 @@
             //      System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG
             if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + extras >
                 ClassFile.MAX_PARAMETERS) {
-                log.error(tree.pos(), "limit.parameters");
+                log.error(tree.pos(), Errors.LimitParameters);
                 nerrs++;
             }
 
@@ -905,7 +906,7 @@
                 }
 
                 if (code.state.stacksize != 0) {
-                    log.error(tree.body.pos(), "stack.sim.error", tree);
+                    log.error(tree.body.pos(), Errors.StackSimError(tree.sym));
                     throw new AssertionError();
                 }
 
@@ -1536,7 +1537,7 @@
                 code.addCatch(startpc1, endpc1, handler_pc1,
                               (char)catch_type);
             } else {
-                log.error(pos, "limit.code.too.large.for.try.stmt");
+                log.error(pos, Errors.LimitCodeTooLargeForTryStmt);
                 nerrs++;
             }
         }
@@ -1769,7 +1770,7 @@
         Item makeNewArray(DiagnosticPosition pos, Type type, int ndims) {
             Type elemtype = types.elemtype(type);
             if (types.dimensions(type) > ClassFile.MAX_DIMENSIONS) {
-                log.error(pos, "limit.dimensions");
+                log.error(pos, Errors.LimitDimensions);
                 nerrs++;
             }
             int elemcode = Code.arraycode(elemtype);
@@ -2181,7 +2182,7 @@
                 genDef(l.head, localEnv);
             }
             if (pool.numEntries() > Pool.MAX_ENTRIES) {
-                log.error(cdef.pos(), "limit.pool");
+                log.error(cdef.pos(), Errors.LimitPool);
                 nerrs++;
             }
             if (nerrs != 0) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Thu Jun 15 13:44:42 2017 +0200
@@ -578,7 +578,7 @@
         if (lintOptions && source.compareTo(Source.DEFAULT) < 0 && !options.isSet(Option.RELEASE)) {
             if (fm instanceof BaseFileManager) {
                 if (((BaseFileManager) fm).isDefaultBootClassPath())
-                    log.warning(LintCategory.OPTIONS, "source.no.bootclasspath", source.name);
+                    log.warning(LintCategory.OPTIONS, Warnings.SourceNoBootclasspath(source.name));
             }
         }
 
@@ -628,7 +628,7 @@
         }
 
         if (obsoleteOptionFound && lintOptions) {
-            log.warning(LintCategory.OPTIONS, "option.obsolete.suppression");
+            log.warning(LintCategory.OPTIONS, Warnings.OptionObsoleteSuppression);
         }
 
         SourceVersion sv = Source.toSourceVersion(source);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Jun 15 13:44:42 2017 +0200
@@ -81,6 +81,8 @@
 
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
+import com.sun.tools.javac.resources.CompilerProperties.Notes;
 import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 
 import static com.sun.tools.javac.code.TypeTag.CLASS;
@@ -393,7 +395,7 @@
             syms = Symtab.instance(context);
         } catch (CompletionFailure ex) {
             // inlined Check.completionError as it is not initialized yet
-            log.error("cant.access", ex.sym, ex.getDetailValue());
+            log.error(Errors.CantAccess(ex.sym, ex.getDetailValue()));
             if (ex instanceof ClassFinder.BadClassFile)
                 throw new Abort();
         }
@@ -570,7 +572,7 @@
      */
     public int errorCount() {
         if (werror && log.nerrors == 0 && log.nwarnings > 0) {
-            log.error("warnings.and.werror");
+            log.error(Errors.WarningsAndWerror);
         }
         return log.nerrors;
     }
@@ -598,7 +600,7 @@
             inputFiles.add(filename);
             return filename.getCharContent(false);
         } catch (IOException e) {
-            log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
+            log.error(Errors.ErrorReadingFile(filename, JavacFileManager.getMessage(e)));
             return null;
         }
     }
@@ -742,10 +744,10 @@
             if (gen.genClass(env, cdef) && (errorCount() == 0))
                 return writer.writeClass(cdef.sym);
         } catch (ClassWriter.PoolOverflow ex) {
-            log.error(cdef.pos(), "limit.pool");
+            log.error(cdef.pos(), Errors.LimitPool);
         } catch (ClassWriter.StringOverflow ex) {
-            log.error(cdef.pos(), "limit.string.overflow",
-                      ex.value.substring(0, 20));
+            log.error(cdef.pos(),
+                      Errors.LimitStringOverflow(ex.value.substring(0, 20)));
         } catch (CompletionFailure ex) {
             chk.completionError(cdef.pos(), ex);
         }
@@ -764,7 +766,7 @@
                                                JavaFileObject.Kind.SOURCE,
                                                null);
         if (inputFiles.contains(outFile)) {
-            log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
+            log.error(cdef.pos(), Errors.SourceCantOverwriteInputFile(outFile));
             return null;
         } else {
             try (BufferedWriter out = new BufferedWriter(outFile.openWriter())) {
@@ -791,7 +793,9 @@
      */
     public void readSourceFile(JCCompilationUnit tree, ClassSymbol c) throws CompletionFailure {
         if (completionFailureName == c.fullname) {
-            throw new CompletionFailure(c, "user-selected completion failure by class name");
+            JCDiagnostic msg =
+                    diagFactory.fragment(Fragments.UserSelectedCompletionFailure);
+            throw new CompletionFailure(c, msg);
         }
         JavaFileObject filename = c.classfile;
         JavaFileObject prev = log.useSource(filename);
@@ -800,7 +804,7 @@
             try {
                 tree = parse(filename, filename.getCharContent(false));
             } catch (IOException e) {
-                log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
+                log.error(Errors.ErrorReadingFile(filename, JavacFileManager.getMessage(e)));
                 tree = make.TopLevel(List.<JCTree>nil());
             } finally {
                 log.useSource(prev);
@@ -819,7 +823,7 @@
         // have enough modules available to access java.lang, and
         // so risk getting FatalError("no.java.lang") from MemberEnter.
         if (!modules.enter(List.of(tree), c)) {
-            throw new CompletionFailure(c, diags.fragment("cant.resolve.modules"));
+            throw new CompletionFailure(c, diags.fragment(Fragments.CantResolveModules));
         }
 
         enter.complete(List.of(tree), c);
@@ -839,20 +843,18 @@
             if (isModuleInfo) {
                 if (enter.getEnv(tree.modle) == null) {
                     JCDiagnostic diag =
-                        diagFactory.fragment("file.does.not.contain.module");
+                        diagFactory.fragment(Fragments.FileDoesNotContainModule);
                     throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory);
                 }
             } else if (isPkgInfo) {
                 if (enter.getEnv(tree.packge) == null) {
                     JCDiagnostic diag =
-                        diagFactory.fragment("file.does.not.contain.package",
-                                                 c.location());
+                        diagFactory.fragment(Fragments.FileDoesNotContainPackage(c.location()));
                     throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory);
                 }
             } else {
                 JCDiagnostic diag =
-                        diagFactory.fragment("file.doesnt.contain.class",
-                                            c.getQualifiedName());
+                        diagFactory.fragment(Fragments.FileDoesntContainClass(c.getQualifiedName()));
                 throw new ClassFinder.BadClassFile(c, filename, diag, diagFactory);
             }
         }
@@ -1177,13 +1179,12 @@
             // annotation processing is to occur with compilation,
             // emit a warning.
             if (options.isSet(PROC, "only")) {
-                log.warning("proc.proc-only.requested.no.procs");
+                log.warning(Warnings.ProcProcOnlyRequestedNoProcs);
                 todo.clear();
             }
             // If not processing annotations, classnames must be empty
             if (!classnames.isEmpty()) {
-                log.error("proc.no.explicit.annotation.processing.requested",
-                          classnames);
+                log.error(Errors.ProcNoExplicitAnnotationProcessingRequested(classnames));
             }
             Assert.checkNull(deferredDiagnosticHandler);
             return ; // continue regular compilation
@@ -1198,8 +1199,7 @@
                  // Check for explicit request for annotation
                  // processing
                 if (!explicitAnnotationProcessingRequested()) {
-                    log.error("proc.no.explicit.annotation.processing.requested",
-                              classnames);
+                    log.error(Errors.ProcNoExplicitAnnotationProcessingRequested(classnames));
                     deferredDiagnosticHandler.reportDeferredDiagnostics();
                     log.popDiagnosticHandler(deferredDiagnosticHandler);
                     return ; // TODO: Will this halt compilation?
@@ -1252,7 +1252,7 @@
                 procEnvImpl.close();
             }
         } catch (CompletionFailure ex) {
-            log.error("cant.access", ex.sym, ex.getDetailValue());
+            log.error(Errors.CantAccess(ex.sym, ex.getDetailValue()));
             if (deferredDiagnosticHandler != null) {
                 deferredDiagnosticHandler.reportDeferredDiagnostics();
                 log.popDiagnosticHandler(deferredDiagnosticHandler);
@@ -1623,8 +1623,8 @@
                 if (results != null && file != null)
                     results.add(file);
             } catch (IOException ex) {
-                log.error(cdef.pos(), "class.cant.write",
-                          cdef.sym, ex.getMessage());
+                log.error(cdef.pos(),
+                          Errors.ClassCantWrite(cdef.sym, ex.getMessage()));
                 return;
             } finally {
                 log.useSource(prev);
@@ -1711,13 +1711,13 @@
                 && implicitSourceFilesRead
                 && implicitSourcePolicy == ImplicitSourcePolicy.UNSET) {
             if (explicitAnnotationProcessingRequested())
-                log.warning("proc.use.implicit");
+                log.warning(Warnings.ProcUseImplicit);
             else
-                log.warning("proc.use.proc.or.implicit");
+                log.warning(Warnings.ProcUseProcOrImplicit);
         }
         chk.reportDeferredDiagnostics();
         if (log.compressedOutput) {
-            log.mandatoryNote(null, "compressed.diags");
+            log.mandatoryNote(null, Notes.CompressedDiags);
         }
     }
 
@@ -1798,7 +1798,7 @@
                     // better written to set any/all exceptions from all the
                     // Closeables as suppressed exceptions on the FatalError
                     // that is thrown.
-                    JCDiagnostic msg = diagFactory.fragment("fatal.err.cant.close");
+                    JCDiagnostic msg = diagFactory.fragment(Fragments.FatalErrCantClose);
                     throw new FatalError(msg, e);
                 }
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Jun 15 13:44:42 2017 +0200
@@ -1244,7 +1244,7 @@
                     if (sel.name != names._class) {
                         return illegal();
                     } else {
-                        log.error(token.pos, "no.annotations.on.dot.class");
+                        log.error(token.pos, Errors.NoAnnotationsOnDotClass);
                         return expr;
                     }
                 }
@@ -3039,7 +3039,7 @@
         int pos = token.pos;
         Name name;
         if (lambdaParameter && token.kind == UNDERSCORE) {
-            log.error(pos, "underscore.as.identifier.in.lambda");
+            log.error(pos, Errors.UnderscoreAsIdentifierInLambda);
             name = token.name();
             nextToken();
         } else {
@@ -3049,10 +3049,10 @@
                     name = ((JCIdent)pn).name;
                 } else {
                     if ((mods.flags & Flags.VARARGS) != 0) {
-                        log.error(token.pos, "varargs.and.receiver");
+                        log.error(token.pos, Errors.VarargsAndReceiver);
                     }
                     if (token.kind == LBRACKET) {
-                        log.error(token.pos, "array.and.receiver");
+                        log.error(token.pos, Errors.ArrayAndReceiver);
                     }
                     return toP(F.at(pos).ReceiverVarDef(mods, pn, type));
                 }
@@ -3062,7 +3062,7 @@
         }
         if ((mods.flags & Flags.VARARGS) != 0 &&
                 token.kind == LBRACKET) {
-            log.error(token.pos, "varargs.and.old.array.syntax");
+            log.error(token.pos, Errors.VarargsAndOldArraySyntax);
         }
         type = bracketsOpt(type);
         return toP(F.at(pos).VarDef(mods, name, type, null));
@@ -3104,7 +3104,7 @@
         } else {
             checkVariableInTryWithResources(startPos);
             if (!t.hasTag(IDENT) && !t.hasTag(SELECT)) {
-                log.error(t.pos(), "try.with.resources.expr.needs.var");
+                log.error(t.pos(), Errors.TryWithResourcesExprNeedsVar);
             }
 
             return t;
@@ -4144,52 +4144,52 @@
 
     void checkDiamond() {
         if (!allowDiamond) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "diamond.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.DiamondNotSupportedInSource(source.name));
         }
     }
     void checkMulticatch() {
         if (!allowMulticatch) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "multicatch.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.MulticatchNotSupportedInSource(source.name));
         }
     }
     void checkTryWithResources() {
         if (!allowTWR) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "try.with.resources.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.TryWithResourcesNotSupportedInSource(source.name));
         }
     }
     void checkVariableInTryWithResources(int startPos) {
         if (!allowEffectivelyFinalVariablesInTWR) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, startPos, "var.in.try.with.resources.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, startPos, Errors.VarInTryWithResourcesNotSupportedInSource(source.name));
         }
     }
     void checkLambda() {
         if (!allowLambda) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "lambda.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.LambdaNotSupportedInSource(source.name));
         }
     }
     void checkMethodReferences() {
         if (!allowMethodReferences) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "method.references.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.MethodReferencesNotSupportedInSource(source.name));
         }
     }
     void checkDefaultMethods() {
         if (!allowDefaultMethods) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "default.methods.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.DefaultMethodsNotSupportedInSource(source.name));
         }
     }
     void checkIntersectionTypesInCast() {
         if (!allowIntersectionTypesInCast) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "intersection.types.in.cast.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.IntersectionTypesInCastNotSupportedInSource(source.name));
         }
     }
     void checkStaticInterfaceMethods() {
         if (!allowStaticInterfaceMethods) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "static.intf.methods.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.StaticIntfMethodsNotSupportedInSource(source.name));
         }
     }
     void checkTypeAnnotations() {
         if (!allowTypeAnnotations) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "type.annotations.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.TypeAnnotationsNotSupportedInSource(source.name));
         }
     }
     void checkPrivateInterfaceMethods() {
@@ -4199,7 +4199,7 @@
     }
     protected void checkAnnotationsAfterTypeParams(int pos) {
         if (!allowAnnotationsAfterTypeParams) {
-            log.error(DiagnosticFlag.SOURCE_LEVEL, pos, "annotations.after.type.params.not.supported.in.source", source.name);
+            log.error(DiagnosticFlag.SOURCE_LEVEL, pos, Errors.AnnotationsAfterTypeParamsNotSupportedInSource(source.name));
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Thu Jun 15 13:44:42 2017 +0200
@@ -29,6 +29,7 @@
 import java.util.Arrays;
 
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.util.ArrayUtils;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Name;
@@ -176,7 +177,7 @@
                         return;
                     }
                 }
-                log.error(bp, "illegal.unicode.esc");
+                log.error(bp, Errors.IllegalUnicodeEsc);
             } else {
                 bp--;
                 ch = '\\';
@@ -231,7 +232,7 @@
         int codePoint = peekSurrogates();
         int result = codePoint >= 0 ? Character.digit(codePoint, base) : Character.digit(c, base);
         if (result >= 0 && c > 0x7f) {
-            log.error(pos + 1, "illegal.nonascii.digit");
+            log.error(pos + 1, Errors.IllegalNonasciiDigit);
             if (codePoint >= 0)
                 scanChar();
             ch = "0123456789abcdef".charAt(result);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Thu Jun 15 13:44:42 2017 +0200
@@ -56,6 +56,7 @@
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.model.JavacElements;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
 
@@ -482,7 +483,7 @@
                 String base = name.substring(periodIndex);
                 String extn = (isSourceFile ? ".java" : ".class");
                 if (base.equals(extn))
-                    log.warning("proc.suspicious.class.name", name, extn);
+                    log.warning(Warnings.ProcSuspiciousClassName(name, extn));
             }
         }
         checkNameAndExistence(mod, name, isSourceFile);
@@ -500,7 +501,7 @@
         checkFileReopening(fileObject, true);
 
         if (lastRound)
-            log.warning("proc.file.create.last.round", name);
+            log.warning(Warnings.ProcFileCreateLastRound(name));
 
         if (isSourceFile)
             aggregateGeneratedSourceNames.add(Pair.of(mod, name));
@@ -690,7 +691,7 @@
     private void checkName(String name, boolean allowUnnamedPackageInfo) throws FilerException {
         if (!SourceVersion.isName(name) && !isPackageInfo(name, allowUnnamedPackageInfo)) {
             if (lint)
-                log.warning("proc.illegal.file.name", name);
+                log.warning(Warnings.ProcIllegalFileName(name));
             throw new FilerException("Illegal name " + name);
         }
     }
@@ -722,7 +723,7 @@
                                initialInputs.contains(existing.sourcefile));
         if (alreadySeen) {
             if (lint)
-                log.warning("proc.type.recreate", typename);
+                log.warning(Warnings.ProcTypeRecreate(typename));
             throw new FilerException("Attempt to recreate a file for type " + typename);
         }
         if (!mod.isUnnamed() && !typename.contains(".")) {
@@ -737,7 +738,7 @@
     private void checkFileReopening(FileObject fileObject, boolean forWriting) throws FilerException {
         if (isInFileObjectHistory(fileObject, forWriting)) {
             if (lint)
-                log.warning("proc.file.reopening", fileObject.getName());
+                log.warning(Warnings.ProcFileReopening(fileObject.getName()));
             throw new FilerException("Attempt to reopen a file for path " + fileObject.getName());
         }
         if (forWriting)
@@ -797,7 +798,7 @@
 
     public void warnIfUnclosedFiles() {
         if (!openTypeNames.isEmpty())
-            log.warning("proc.unclosed.type.files", openTypeNames.toString());
+            log.warning(Warnings.ProcUnclosedTypeFiles(openTypeNames));
     }
 
     /**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Thu Jun 15 13:44:42 2017 +0200
@@ -26,6 +26,9 @@
 package com.sun.tools.javac.processing;
 
 import com.sun.tools.javac.model.JavacElements;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Notes;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
@@ -114,21 +117,21 @@
             switch (kind) {
             case ERROR:
                 errorCount++;
-                log.error(DiagnosticFlag.MULTIPLE, pos, "proc.messager", msg.toString());
+                log.error(DiagnosticFlag.MULTIPLE, pos, Errors.ProcMessager(msg.toString()));
                 break;
 
             case WARNING:
                 warningCount++;
-                log.warning(pos, "proc.messager", msg.toString());
+                log.warning(pos, Warnings.ProcMessager(msg.toString()));
                 break;
 
             case MANDATORY_WARNING:
                 warningCount++;
-                log.mandatoryWarning(pos, "proc.messager", msg.toString());
+                log.mandatoryWarning(pos, Warnings.ProcMessager(msg.toString()));
                 break;
 
             default:
-                log.note(pos, "proc.messager", msg.toString());
+                log.note(pos, Notes.ProcMessager(msg.toString()));
                 break;
             }
         } finally {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Jun 15 13:44:42 2017 +0200
@@ -69,6 +69,7 @@
 import com.sun.tools.javac.platform.PlatformDescription;
 import com.sun.tools.javac.platform.PlatformDescription.PluginInfo;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Abort;
@@ -412,7 +413,7 @@
                     this.iterator = handleServiceLoaderUnavailability("proc.no.service", null);
                 }
             } catch (Throwable t) {
-                log.error("proc.service.problem");
+                log.error(Errors.ProcServiceProblem);
                 throw new Abort(t);
             }
         }
@@ -428,7 +429,7 @@
             try {
                 return internalHasNext();
             } catch(ServiceConfigurationError sce) {
-                log.error("proc.bad.config.file", sce.getLocalizedMessage());
+                log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
                 throw new Abort(sce);
             } catch (Throwable t) {
                 throw new Abort(t);
@@ -444,7 +445,7 @@
             try {
                 return internalNext();
             } catch (ServiceConfigurationError sce) {
-                log.error("proc.bad.config.file", sce.getLocalizedMessage());
+                log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
                 throw new Abort(sce);
             } catch (Throwable t) {
                 throw new Abort(t);
@@ -561,13 +562,13 @@
                     ensureReadable(processorClass);
                     return (Processor) processorClass.getConstructor().newInstance();
                 } catch (ClassNotFoundException cnfe) {
-                    log.error("proc.processor.not.found", processorName);
+                    log.error(Errors.ProcProcessorNotFound(processorName));
                     return null;
                 } catch (ClassCastException cce) {
-                    log.error("proc.processor.wrong.type", processorName);
+                    log.error(Errors.ProcProcessorWrongType(processorName));
                     return null;
                 } catch (Exception e ) {
-                    log.error("proc.processor.cant.instantiate", processorName);
+                    log.error(Errors.ProcProcessorCantInstantiate(processorName));
                     return null;
                 }
             } catch (ClientCodeException e) {
@@ -707,19 +708,17 @@
             SourceVersion procSourceVersion = processor.getSupportedSourceVersion();
 
             if (procSourceVersion.compareTo(Source.toSourceVersion(source)) < 0 )  {
-                log.warning("proc.processor.incompatible.source.version",
-                            procSourceVersion,
-                            processor.getClass().getName(),
-                            source.name);
+                log.warning(Warnings.ProcProcessorIncompatibleSourceVersion(procSourceVersion,
+                                                                            processor.getClass().getName(),
+                                                                            source.name));
             }
         }
 
         private boolean checkOptionName(String optionName, Log log) {
             boolean valid = isValidOptionName(optionName);
             if (!valid)
-                log.error("proc.processor.bad.option.name",
-                            optionName,
-                            processor.getClass().getName());
+                log.error(Errors.ProcProcessorBadOptionName(optionName,
+                                                            processor.getClass().getName()));
             return valid;
         }
 
@@ -904,8 +903,7 @@
             // Remove annotations processed by javac
             unmatchedAnnotations.keySet().removeAll(platformAnnotations);
             if (unmatchedAnnotations.size() > 0) {
-                log.warning("proc.annotations.without.processors",
-                            unmatchedAnnotations.keySet());
+                log.warning(Warnings.ProcAnnotationsWithoutProcessors(unmatchedAnnotations.keySet()));
             }
         }
 
@@ -967,12 +965,12 @@
         try {
             return proc.process(tes, renv);
         } catch (ClassFinder.BadClassFile ex) {
-            log.error("proc.cant.access.1", ex.sym, ex.getDetailValue());
+            log.error(Errors.ProcCantAccess1(ex.sym, ex.getDetailValue()));
             return false;
         } catch (CompletionFailure ex) {
             StringWriter out = new StringWriter();
             ex.printStackTrace(new PrintWriter(out));
-            log.error("proc.cant.access", ex.sym, ex.getDetailValue(), out.toString());
+            log.error(Errors.ProcCantAccess(ex.sym, ex.getDetailValue(), out.toString()));
             return false;
         } catch (ClientCodeException e) {
             throw e;
@@ -1385,7 +1383,7 @@
 
     private void warnIfUnmatchedOptions() {
         if (!unmatchedProcessorOptions.isEmpty()) {
-            log.warning("proc.unmatched.processor.options", unmatchedProcessorOptions.toString());
+            log.warning(Warnings.ProcUnmatchedProcessorOptions(unmatchedProcessorOptions.toString()));
         }
     }
 
@@ -1490,7 +1488,7 @@
                 throw new AssertionError(ex);
             }
             catch (ServiceProxy.ServiceConfigurationError e) {
-                log.error("proc.bad.config.file", e.getLocalizedMessage());
+                log.error(Errors.ProcBadConfigFile(e.getLocalizedMessage()));
                 return true;
             }
         }
@@ -1682,7 +1680,7 @@
         if (MatchingUtils.isValidImportString(pkg)) {
             return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg));
         } else {
-            log.warning("proc.malformed.supported.string", s, p.getClass().getName());
+            log.warning(Warnings.ProcMalformedSupportedString(s, p.getClass().getName()));
             return noMatches; // won't match any valid identifier
         }
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jun 15 13:44:42 2017 +0200
@@ -28,12 +28,14 @@
 # values.
 # The simple types currently in use are:
 #
+# annotation        annotation compound
 # boolean           true or false
 # diagnostic        a sub-message; see compiler.misc.*
 # fragment          similar to 'message segment', but with more specific type
 # modifier          a Java modifier; e.g. public, private, protected
 # file              a file URL
 # file object       a file URL - similar to 'file' but typically used for source/class files, hence more specific
+# flag              a Flags.Flag instance
 # name              a name, typically a Java identifier
 # number            an integer
 # option name       the name of a command line option
@@ -49,8 +51,9 @@
 #
 # The following compound types are also used:
 #
+# collection of X   a comma-separated collection of items; e.g. collection of type
 # list of X         a comma-separated list of items; e.g. list of type
-# set of X          a comma-separated collection of items; e.g. set of modifier
+# set of X          a comma-separated set of items; e.g. set of modifier
 #
 # These may be composed:
 #
@@ -59,7 +62,7 @@
 # The following type aliases are supported:
 #
 # message segment --> diagnostic or fragment
-# file name --> file or file object
+# file name --> file, path or file object
 #
 # Custom comments are supported in parenthesis i.e.
 #
@@ -85,25 +88,27 @@
 compiler.err.abstract.meth.cant.have.body=\
     abstract methods cannot have a body
 
+# 0: kind name, 1: symbol
 compiler.err.already.annotated=\
     {0} {1} has already been annotated
 
-# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol
+# 0: kind name, 1: symbol, 2: kind name, 3: symbol
 compiler.err.already.defined=\
     {0} {1} is already defined in {2} {3}
 
-# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol kind, 4: symbol
+# 0: kind name, 1: symbol, 2: kind name, 3: kind name, 4: symbol
 compiler.err.already.defined.in.clinit=\
     {0} {1} is already defined in {2} of {3} {4}
 
-# 0: string
+# 0: symbol
 compiler.err.already.defined.single.import=\
     a type with the same simple name is already defined by the single-type-import of {0}
 
-# 0: string
+# 0: symbol
 compiler.err.already.defined.static.single.import=\
     a type with the same simple name is already defined by the static single-type-import of {0}
 
+# 0: symbol
 compiler.err.already.defined.this.unit=\
     {0} is already defined in this compilation unit
 
@@ -197,11 +202,11 @@
 compiler.misc.cant.apply.symbols=\
     no suitable {0} found for {1}({2})
 
-# 0: symbol kind, 1: symbol
+# 0: kind name, 1: symbol
 compiler.misc.no.abstracts=\
     no abstract method found in {0} {1}
 
-# 0: symbol kind, 1: symbol
+# 0: kind name, 1: symbol
 compiler.misc.incompatible.abstracts=\
     multiple non-overriding abstract methods found in {0} {1}
 
@@ -227,12 +232,12 @@
     {0} is not a functional interface\n\
     {1}
 
-# 0: symbol, 1: symbol kind, 2: symbol
+# 0: type, 1: kind name, 2: symbol
 compiler.misc.invalid.generic.lambda.target=\
     invalid functional descriptor for lambda expression\n\
     method {0} in {1} {2} is generic
 
-# 0: symbol kind, 1: symbol
+# 0: kind name, 1: symbol
 compiler.misc.incompatible.descs.in.functional.intf=\
     incompatible function descriptors found in {0} {1}
 
@@ -257,7 +262,7 @@
 compiler.misc.not.an.intf.component=\
     component type {0} is not an interface
 
-# 0: symbol kind, 1: message segment
+# 0: kind name, 1: message segment
 compiler.err.invalid.mref=\
     invalid {0} reference\n\
     {1}
@@ -307,7 +312,7 @@
 compiler.err.cant.inherit.from.final=\
     cannot inherit from final {0}
 
-# 0: symbol
+# 0: symbol or string
 compiler.err.cant.ref.before.ctor.called=\
     cannot reference {0} before supertype constructor has been called
 
@@ -321,7 +326,7 @@
 compiler.err.catch.without.try=\
     ''catch'' without ''try''
 
-# 0: symbol kind, 1: symbol
+# 0: kind name, 1: symbol
 compiler.err.clash.with.pkg.of.same.name=\
     {0} {1} clashes with package of same name
 
@@ -334,7 +339,7 @@
 compiler.err.cont.outside.loop=\
     continue outside of loop
 
-# 0: symbol
+# 0: symbol or type
 compiler.err.cyclic.inheritance=\
     cyclic inheritance involving {0}
 
@@ -342,7 +347,7 @@
 compiler.err.cyclic.annotation.element=\
     type of element {0} is cyclic
 
-# 0: unused
+# 0: symbol
 compiler.err.call.to.super.not.allowed.in.enum.ctor=\
     call to super not allowed in enum constructor
 
@@ -350,7 +355,7 @@
 compiler.err.no.superclass=\
     {0} has no superclass.
 
-# 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
+# 0: symbol, 1: type, 2: symbol, 3: type, 4: type
 compiler.err.concrete.inheritance.conflict=\
     methods {0} from {1} and {2} from {3} are inherited with the same signature
 
@@ -369,11 +374,11 @@
 compiler.err.duplicate.annotation.member.value=\
     duplicate element ''{0}'' in annotation @{1}.
 
-# 0: name, 1: unused
+# 0: type
 compiler.err.duplicate.annotation.missing.container=\
     {0} is not a repeatable annotation type
 
-# 0: type, 1: unused
+# 0: symbol
 compiler.err.invalid.repeatable.annotation=\
     duplicate annotation: {0} is annotated with an invalid @Repeatable annotation
 
@@ -389,7 +394,7 @@
 compiler.err.invalid.repeatable.annotation.invalid.value=\
     {0} is not a valid @Repeatable: invalid value element
 
-# 0: symbol or type, 1: unused, 2: type
+# 0: symbol or type, 1: type, 2: type
 compiler.err.invalid.repeatable.annotation.value.return=\
     containing annotation type ({0}) must declare an element named ''value'' of type {2}
 
@@ -397,7 +402,7 @@
 compiler.err.invalid.repeatable.annotation.elem.nondefault=\
     containing annotation type ({0}) does not have a default value for element {1}
 
-# 0: symbol, 1: unused, 2: symbol, 3: unused
+# 0: symbol, 1: string, 2: symbol, 3: string
 compiler.err.invalid.repeatable.annotation.retention=\
     retention of containing annotation type ({0}) is shorter than the retention of repeatable annotation type ({2})
 
@@ -526,7 +531,7 @@
 compiler.err.illegal.char.for.encoding=\
     unmappable character (0x{0}) for encoding {1}
 
-# 0: set of modifier, 1: set of modifier
+# 0: set of flag, 1: set of flag
 compiler.err.illegal.combination.of.modifiers=\
     illegal combination of modifiers: {0} and {1}
 
@@ -539,7 +544,7 @@
 compiler.err.illegal.forward.ref=\
     illegal forward reference
 
-# 0: symbol, 1: string
+# 0: symbol, 1: object
 compiler.err.not.in.profile=\
     {0} is not available in profile ''{1}''
 
@@ -627,9 +632,8 @@
 compiler.err.intf.meth.cant.have.body=\
     interface abstract methods cannot have body
 
-# 0: symbol
 compiler.err.invalid.annotation.member.type=\
-    invalid type for element {0} of annotation type
+    invalid type for annotation type element
 
 compiler.err.invalid.binary.number=\
     binary numbers must contain at least one binary digit
@@ -707,6 +711,7 @@
 compiler.err.limit.string=\
     constant string too long
 
+# 0: string
 compiler.err.limit.string.overflow=\
     UTF8 representation for string \"{0}...\" is too long for the constant pool
 
@@ -722,14 +727,14 @@
 compiler.err.missing.ret.stmt=\
     missing return statement
 
-# 0: unused
+# 0: type
 compiler.misc.missing.ret.val=\
     missing return value
 
 compiler.misc.unexpected.ret.val=\
     unexpected return value
 
-# 0: set of modifier
+# 0: set of flag
 compiler.err.mod.not.allowed.here=\
     modifier {0} not allowed here
 
@@ -778,7 +783,7 @@
 compiler.misc.conditional.target.cant.be.void=\
     target-type for conditional expression cannot be void
 
-# 0: type
+# 0: message segment
 compiler.misc.incompatible.ret.type.in.lambda=\
     bad return type in lambda expression\n\
     {0}
@@ -787,7 +792,7 @@
     lambda body is not compatible with a void functional interface\n\
     (consider using a block lambda body, or use a statement expression instead)
 
-# 0: type
+# 0: message segment
 compiler.misc.incompatible.ret.type.in.mref=\
     bad return type in method reference\n\
     {0}
@@ -808,9 +813,11 @@
 compiler.err.new.not.allowed.in.annotation=\
     ''new'' not allowed in an annotation
 
+# 0: name, 1: type
 compiler.err.no.annotation.member=\
     no annotation member {0} in {1}
 
+# 0: symbol
 compiler.err.no.encl.instance.of.type.in.scope=\
     no enclosing instance of type {0} is in scope
 
@@ -820,6 +827,7 @@
 compiler.err.no.match.entry=\
     {0} has no match in entry in {1}; required {2}
 
+# 0: type
 compiler.err.not.annotation.type=\
     {0} is not an annotation type
 
@@ -958,14 +966,14 @@
 
 # Errors related to annotation processing
 
-# 0: symbol, 1: string, 2: string (stack-trace)
+# 0: symbol, 1: message segment, 2: string (stack-trace)
 compiler.err.proc.cant.access=\
     cannot access {0}\n\
     {1}\n\
     Consult the following stack trace for details.\n\
     {2}
 
-# 0: symbol, 1: string
+# 0: symbol, 1: message segment
 compiler.err.proc.cant.access.1=\
     cannot access {0}\n\
     {1}
@@ -979,13 +987,21 @@
 compiler.err.proc.messager=\
     {0}
 
-# 0: list of string
+# 0: string
+compiler.misc.exception.message=\
+    {0}
+
+compiler.misc.user.selected.completion.failure=\
+    user-selected completion failure by class name
+
+# 0: collection of string
 compiler.err.proc.no.explicit.annotation.processing.requested=\
     Class names, ''{0}'', are only accepted if annotation processing is explicitly requested
 
 compiler.err.proc.no.service=\
     A ServiceLoader was not usable and is required for annotation processing.
 
+# 0: string, 1: string
 compiler.err.proc.processor.bad.option.name=\
     Bad option name ''{0}'' provided by processor ''{1}''
 
@@ -1004,13 +1020,14 @@
 compiler.err.proc.service.problem=\
     Error creating a service loader to load Processors.
 
+# 0: string
 compiler.err.proc.bad.config.file=\
     Bad service configuration file, or exception thrown while constructing Processor object: {0}
 
 compiler.err.proc.cant.create.loader=\
     Could not create class loader for annotation processors: {0}
 
-# 0: unused
+# 0: symbol
 compiler.err.qualified.new.of.static.class=\
     qualified new of static class
 
@@ -1061,9 +1078,11 @@
 compiler.err.does.not.override.abstract=\
     {0} is not abstract and does not override abstract method {1} in {2}
 
+# 0: file object
 compiler.err.source.cant.overwrite.input.file=\
     error writing source; cannot overwrite input file {0}
 
+# 0: symbol
 compiler.err.stack.sim.error=\
     Internal error: stack sim error on {0}
 
@@ -1123,7 +1142,7 @@
     illegal static interface method call\n\
     the receiver expression should be replaced with the type qualifier ''{0}''
 
-# 0: type, 1: message segment
+# 0: symbol or type, 1: message segment
 compiler.err.illegal.default.super.call=\
     bad type qualifier {0} in default super call\n\
     {1}
@@ -1145,7 +1164,7 @@
 compiler.err.unclosed.str.lit=\
     unclosed string literal
 
-# 0: name
+# 0: string
 compiler.err.unsupported.encoding=\
     unsupported encoding: {0}
 
@@ -1314,12 +1333,15 @@
 compiler.misc.fatal.err.no.java.lang=\
     Fatal Error: Unable to find package java.lang in classpath or bootclasspath
 
+# 0: name
 compiler.misc.fatal.err.cant.locate.meth=\
     Fatal Error: Unable to find method {0}
 
+# 0: name
 compiler.misc.fatal.err.cant.locate.field=\
     Fatal Error: Unable to find field {0}
 
+# 0: type
 compiler.misc.fatal.err.cant.locate.ctor=\
     Fatal Error: Unable to find constructor for {0}
 
@@ -1527,7 +1549,7 @@
 compiler.warn.constant.SVUID=\
     serialVersionUID must be constant in class {0}
 
-# 0: file name
+# 0: path
 compiler.warn.dir.path.element.not.found=\
     bad path element "{0}": no such directory
 
@@ -1609,6 +1631,7 @@
 compiler.warn.override.varargs.extra=\
     {0}; overriding method is missing ''...''
 
+# 0: message segment
 compiler.warn.override.bridge=\
     {0}; overridden method is a bridge method
 
@@ -1616,7 +1639,7 @@
 compiler.warn.pkg-info.already.seen=\
     a package-info.java file has already been seen for package {0}
 
-# 0: file name
+# 0: path
 compiler.warn.path.element.not.found=\
     bad path element "{0}": no such file or directory
 
@@ -1678,7 +1701,7 @@
 compiler.warn.proc.package.does.not.exist=\
     package {0} does not exist
 
-# 0: name
+# 0: string
 compiler.warn.proc.file.reopening=\
     Attempt to create a file for ''{0}'' multiple times
 
@@ -1686,7 +1709,7 @@
 compiler.warn.proc.type.already.exists=\
     A file for type ''{0}'' already exists on the sourcepath or classpath
 
-# 0: name
+# 0: string
 compiler.warn.proc.type.recreate=\
     Attempt to create a file for type ''{0}'' multiple times
 
@@ -1698,7 +1721,7 @@
 compiler.warn.proc.suspicious.class.name=\
     Creating file for a type whose name ends in {1}: ''{0}''
 
-# 0: name
+# 0: string
 compiler.warn.proc.file.create.last.round=\
     File for type ''{0}'' created in the last round will not be subject to annotation processing.
 
@@ -1730,7 +1753,7 @@
 compiler.warn.proc.messager=\
     {0}
 
-# 0: set of name
+# 0: set of string
 compiler.warn.proc.unclosed.type.files=\
     Unclosed files for the types ''{0}''; these types will not undergo annotation processing
 
@@ -1784,16 +1807,19 @@
 compiler.warn.missing.deprecated.annotation=\
     deprecated item is not annotated with @Deprecated
 
-# 0: symbol kind
+# 0: kind name
 compiler.warn.deprecated.annotation.has.no.effect=\
     @Deprecated annotation has no effect on this {0} declaration
 
+# 0: string
 compiler.warn.invalid.path=\
     Invalid filename: {0}
 
+# 0: path
 compiler.warn.invalid.archive.file=\
     Unexpected file on path: {0}
 
+# 0: path
 compiler.warn.unexpected.archive.file=\
     Unexpected extension for archive file: {0}
 
@@ -1807,17 +1833,19 @@
 compiler.warn.empty.if=\
     empty statement after if
 
+# 0: type, 1: name
 compiler.warn.annotation.method.not.found=\
     Cannot find annotation method ''{1}()'' in type ''{0}''
 
+# 0: type, 1: name, 2: message segment
 compiler.warn.annotation.method.not.found.reason=\
     Cannot find annotation method ''{1}()'' in type ''{0}'': {2}
 
-# 0: symbol, 1: name
+# 0: file object, 1: symbol, 2: name
 compiler.warn.unknown.enum.constant=\
     unknown enum constant {1}.{2}
 
-# 0: symbol, 1: name, 2: message segment
+# 0: file object, 1: symbol, 2: name, 3: message segment
 compiler.warn.unknown.enum.constant.reason=\
     unknown enum constant {1}.{2}\n\
     reason: {3}
@@ -1827,7 +1855,6 @@
     found raw type: {0}\n\
     missing type arguments for generic class {1}
 
-# 0: unused, 1: unused
 compiler.warn.diamond.redundant.args=\
     Redundant type arguments in new expression (use diamond operator instead).
 
@@ -2004,6 +2031,7 @@
 compiler.misc.module.info.invalid.super.class=\
     module-info with invalid super class
 
+# 0: name
 compiler.misc.class.file.not.found=\
     class file for {0} not found
 
@@ -2031,6 +2059,7 @@
 compiler.misc.file.doesnt.contain.class=\
     file does not contain class {0}
 
+# 0: symbol
 compiler.misc.file.does.not.contain.package=\
     file does not contain package {0}
 
@@ -2105,14 +2134,14 @@
 # compiler.err.no.elem.type=\
 #     \[\*\] cannot have a type
 
-# 0: type
+# 0: message segment
 compiler.misc.try.not.applicable.to.type=\
     try-with-resources not applicable to variable type\n\
     ({0})
 
 #####
 
-# 0: message segment or type, 1: message segment
+# 0: object, 1: message segment
 compiler.err.type.found.req=\
     unexpected type\n\
     required: {1}\n\
@@ -2232,11 +2261,10 @@
     type arguments {0} inferred for {1} are not allowed in this context\n\
     inferred arguments are not expressible in the Signature attribute
 
-# 0: unused
+# 0: type
 compiler.misc.diamond.and.explicit.params=\
     cannot use ''<>'' with explicit type parameters for constructor
 
-# 0: unused
 compiler.misc.mref.infer.and.explicit.params=\
     cannot use raw constructor reference with explicit type parameters for constructor
 
@@ -2266,7 +2294,7 @@
     auxiliary class {0} in {1} should not be accessed from outside its own source file
 
 ## The first argument ({0}) is a "kindname".
-# 0: symbol kind, 1: symbol, 2: symbol
+# 0: kind name, 1: symbol, 2: symbol
 compiler.err.abstract.cant.be.accessed.directly=\
     abstract {0} {1} in {2} cannot be accessed directly
 
@@ -2289,6 +2317,7 @@
 
 ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
 ## of kindnames (the list should be identical to that provided in source.
+# 0: set of kind name, 1: set of kind name
 compiler.err.unexpected.type=\
     unexpected type\n\
     required: {0}\n\
@@ -2304,36 +2333,36 @@
 ## The second argument {1} is the non-resolved symbol
 ## The third argument {2} is a list of type parameters (non-empty if {1} is a method)
 ## The fourth argument {3} is a list of argument types (non-empty if {1} is a method)
-# 0: symbol kind, 1: name, 2: unused, 3: unused
+# 0: kind name, 1: name, 2: unused, 3: unused
 compiler.err.cant.resolve=\
     cannot find symbol\n\
     symbol: {0} {1}
 
-# 0: symbol kind, 1: name, 2: unused, 3: list of type
+# 0: kind name, 1: name, 2: unused, 3: list of type
 compiler.err.cant.resolve.args=\
     cannot find symbol\n\
     symbol: {0} {1}({3})
 
-# 0: symbol kind, 1: name, 2: list of type, 3: list of type
+# 0: kind name, 1: name, 2: list of type, 3: list of type
 compiler.err.cant.resolve.args.params=\
     cannot find symbol\n\
     symbol: {0} <{2}>{1}({3})
 
 ## arguments from {0} to {3} have the same meaning as above
 ## The fifth argument {4} is a location subdiagnostic (see below)
-# 0: symbol kind, 1: name, 2: unused, 3: unused, 4: message segment
+# 0: kind name, 1: name, 2: unused, 3: unused, 4: message segment
 compiler.err.cant.resolve.location=\
     cannot find symbol\n\
     symbol:   {0} {1}\n\
     location: {4}
 
-# 0: symbol kind, 1: name, 2: unused, 3: list of type, 4: message segment
+# 0: kind name, 1: name, 2: unused, 3: list of type, 4: message segment
 compiler.err.cant.resolve.location.args=\
     cannot find symbol\n\
     symbol:   {0} {1}({3})\n\
     location: {4}
 
-# 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
+# 0: kind name, 1: name, 2: list of type, 3: list, 4: message segment
 compiler.err.cant.resolve.location.args.params=\
     cannot find symbol\n\
     symbol:   {0} <{2}>{1}({3})\n\
@@ -2341,13 +2370,13 @@
 
 ### Following are replicated/used for method reference diagnostics
 
-# 0: symbol kind, 1: name, 2: unused, 3: list of type, 4: message segment
+# 0: kind name, 1: name, 2: unused, 3: list of type, 4: message segment
 compiler.misc.cant.resolve.location.args=\
     cannot find symbol\n\
     symbol:   {0} {1}({3})\n\
     location: {4}
 
-# 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
+# 0: kind name, 1: name, 2: list of type, 3: list, 4: message segment
 compiler.misc.cant.resolve.location.args.params=\
     cannot find symbol\n\
     symbol:   {0} <{2}>{1}({3})\n\
@@ -2358,11 +2387,11 @@
 ## The second argument {1} is the location name
 ## The third argument {2} is the location type (only when {1} is a variable name)
 
-# 0: symbol kind, 1: type or symbol, 2: unused
+# 0: kind name, 1: type or symbol, 2: unused
 compiler.misc.location=\
     {0} {1}
 
-# 0: symbol kind, 1: symbol, 2: type
+# 0: kind name, 1: symbol, 2: type
 compiler.misc.location.1=\
     {0} {1} of type {2}
 
@@ -2426,7 +2455,7 @@
     {0}\n\
     overriding method is static
 
-# 0: message segment, 1: set of modifier
+# 0: message segment, 1: set of flag
 compiler.err.override.meth=\
     {0}\n\
     overridden method is {1}
@@ -2438,7 +2467,7 @@
 
 # In the following string {1} is a space separated list of Java Keywords, as
 # they would have been declared in the source code
-# 0: message segment, 1: set of modifier
+# 0: message segment, 1: set of flag or string
 compiler.err.override.weaker.access=\
     {0}\n\
     attempting to assign weaker access privileges; was {1}
@@ -2504,7 +2533,7 @@
 compiler.misc.varargs.clash.with=\
     {0} in {1} overrides {2} in {3}
 
-# 0: symbol kind, 1: symbol, 2: symbol, 3: message segment
+# 0: kind name, 1: symbol, 2: symbol, 3: message segment
 compiler.misc.inapplicable.method=\
     {0} {1}.{2} is not applicable\n\
     ({3})
@@ -2563,17 +2592,16 @@
 compiler.err.this.as.identifier=\
     as of release 8, ''this'' is allowed as the parameter name for the receiver type only, which has to be the first parameter
 
-# 0: symbol
 compiler.err.receiver.parameter.not.applicable.constructor.toplevel.class=\
     receiver parameter not applicable for constructor of top-level class
 
 # TODO 308: make a better error message
-# 0: symbol
+# 0: annotation
 compiler.err.cant.type.annotate.scoping.1=\
     scoping construct cannot be annotated with type-use annotation: {0}
 
 # TODO 308: make a better error message
-# 0: list of symbol
+# 0: list of annotation
 compiler.err.cant.type.annotate.scoping=\
     scoping construct cannot be annotated with type-use annotations: {0}
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Jun 15 13:44:42 2017 +0200
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.TypeTag.*;
@@ -520,7 +521,7 @@
                 if (indexOf(t, WhereClauseKind.INTERSECTION) == -1) {
                     Type supertype = types.supertype(t);
                     List<Type> interfaces = types.interfaces(t);
-                    JCDiagnostic d = diags.fragment("where.intersection", t, interfaces.prepend(supertype));
+                    JCDiagnostic d = diags.fragment(Fragments.WhereIntersection(t, interfaces.prepend(supertype)));
                     whereClauses.get(WhereClauseKind.INTERSECTION).put(t, d);
                     visit(supertype);
                     visit(interfaces);
@@ -575,7 +576,7 @@
                 } else {
                     Assert.check(!boundErroneous);
                     //this is a fresh (synthetic) tvar
-                    JCDiagnostic d = diags.fragment("where.fresh.typevar", t, bounds);
+                    JCDiagnostic d = diags.fragment(Fragments.WhereFreshTypevar(t, bounds));
                     whereClauses.get(WhereClauseKind.TYPEVAR).put(t, d);
                     visit(bounds);
                 }
--- a/langtools/test/tools/javac/T5024091/T5024091.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/T5024091/T5024091.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-T5024091.java:12:29: compiler.err.cant.access: java.lang.StringBuilder, user-selected completion failure by class name
+T5024091.java:12:29: compiler.err.cant.access: java.lang.StringBuilder, (compiler.misc.user.selected.completion.failure)
 1 error
--- a/langtools/test/tools/javac/annotations/neg/Cycle1.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/neg/Cycle1.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-Cycle1.java:13:9: compiler.err.cyclic.annotation.element
+Cycle1.java:13:9: compiler.err.cyclic.annotation.element: cycle1.Foo
 1 error
--- a/langtools/test/tools/javac/annotations/neg/Cycle2.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/neg/Cycle2.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-Cycle2.java:13:9: compiler.err.cyclic.annotation.element
+Cycle2.java:13:9: compiler.err.cyclic.annotation.element: cycle2.Bar
 1 error
--- a/langtools/test/tools/javac/annotations/neg/Cycle3.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/neg/Cycle3.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-Cycle3.java:17:9: compiler.err.cyclic.annotation.element
+Cycle3.java:17:9: compiler.err.cyclic.annotation.element: cycle3.A
 1 error
--- a/langtools/test/tools/javac/annotations/neg/Dup.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/neg/Dup.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-Dup.java:11:1: compiler.err.duplicate.annotation.missing.container: Dup, java.lang.annotation.Repeatable
+Dup.java:11:1: compiler.err.duplicate.annotation.missing.container: Dup
 1 error
--- a/langtools/test/tools/javac/annotations/neg/Z14.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/neg/Z14.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-Z14.java:10:15: compiler.err.intf.annotation.cant.have.type.params
+Z14.java:10:15: compiler.err.intf.annotation.cant.have.type.params: An
 1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-BaseAnnoAsContainerAnno.java:13:11: compiler.err.cyclic.annotation.element
+BaseAnnoAsContainerAnno.java:13:11: compiler.err.cyclic.annotation.element: Foo
 1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-CyclicAnnotation.java:13:11: compiler.err.cyclic.annotation.element
+CyclicAnnotation.java:13:11: compiler.err.cyclic.annotation.element: Baz
 1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/DuplicateErrors.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/DuplicateErrors.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,3 +1,3 @@
-DuplicateErrors.java:34:1: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
-DuplicateErrors.java:35:1: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
+DuplicateErrors.java:34:1: compiler.err.duplicate.annotation.missing.container: Foo
+DuplicateErrors.java:35:1: compiler.err.duplicate.annotation.missing.container: Foo
 2 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/NoRepeatableAnno.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/NoRepeatableAnno.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-NoRepeatableAnno.java:11:6: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
+NoRepeatableAnno.java:11:6: compiler.err.duplicate.annotation.missing.container: Foo
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:11:15: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:11:15: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:11:20: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:11:20: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:11:32: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:11:32: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:9:38: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:9:38: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:10:16: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:10:16: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/rest/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/rest/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:11:12: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:11:12: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:9:28: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:9:28: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DuplicateTypeAnnotation.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DuplicateTypeAnnotation.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation.missing.container: A
 1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,28 +1,28 @@
-RepeatingTypeAnnotations.java:39:25: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:41:25: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:42:25: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:50:31: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:52:24: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:61:21: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:63:38: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:65:24: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:72:21: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:77:28: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:79:21: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:79:36: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:81:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:85:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:85:34: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:89:18: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:89:33: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:93:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:93:35: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:97:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:97:34: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:101:37: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:101:26: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:101:56: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
-RepeatingTypeAnnotations.java:101:72: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:39:25: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:41:25: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:42:25: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:50:31: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:52:24: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:61:21: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:63:38: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:65:24: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:72:21: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:77:28: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:79:21: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:79:36: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:81:19: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:85:19: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:85:34: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:89:18: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:89:33: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:93:19: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:93:35: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:97:19: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:97:34: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:101:37: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:101:26: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:101:56: compiler.err.duplicate.annotation.missing.container: TA
+RepeatingTypeAnnotations.java:101:72: compiler.err.duplicate.annotation.missing.container: TA
 - compiler.note.unchecked.filename: RepeatingTypeAnnotations.java
 - compiler.note.unchecked.recompile
 25 errors
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Thu Jun 15 13:44:42 2017 +0200
@@ -56,6 +56,7 @@
 compiler.misc.base.membership                           # UNUSED
 compiler.misc.class.file.not.found                      # ClassReader
 compiler.misc.class.file.wrong.class
+compiler.misc.exception.message                         # uncommon completion failure based on a string
 compiler.misc.fatal.err.cant.locate.ctor                # Resolve, from Lower
 compiler.misc.fatal.err.cant.locate.field               # Resolve, from Lower
 compiler.misc.fatal.err.cant.locate.meth                # Resolve, from Lower
@@ -94,6 +95,7 @@
 compiler.misc.unable.to.access.file                     # ClassFile
 compiler.misc.undecl.type.var                           # ClassReader
 compiler.misc.unicode.str.not.supported                 # ClassReader
+compiler.misc.user.selected.completion.failure          # manual completion failure
 compiler.misc.malformed.vararg.method                   # ClassReader
 compiler.misc.version.not.available                     # JavaCompiler; implies build error
 compiler.misc.where.description.captured
--- a/langtools/test/tools/javac/importChecks/NoImportedNoClasses.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/importChecks/NoImportedNoClasses.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,2 +1,2 @@
-NoImportedNoClasses.java:10:1: compiler.err.cant.resolve.location: kindname.static, UNKNOWN, , , kindname.interface, java.lang.Runnable
+NoImportedNoClasses.java:10:1: compiler.err.cant.resolve.location: kindname.static, UNKNOWN, null, null, (compiler.misc.location: kindname.interface, java.lang.Runnable, null)
 1 error
\ No newline at end of file
--- a/langtools/test/tools/javac/staticImport/ImportPrivate.out	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/test/tools/javac/staticImport/ImportPrivate.out	Thu Jun 15 13:44:42 2017 +0200
@@ -1,3 +1,3 @@
-ImportPrivate.java:12:1: compiler.err.cant.resolve.location: kindname.static, m, , , kindname.class, importPrivate.A
+ImportPrivate.java:12:1: compiler.err.cant.resolve.location: kindname.static, m, null, null, (compiler.misc.location: kindname.class, importPrivate.A, null)
 ImportPrivate.java:22:9: compiler.err.cant.resolve.location.args: kindname.method, m, , , (compiler.misc.location: kindname.class, importPrivate.MyTest, null)
 2 errors