--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Fri Feb 02 23:21:12 2018 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Fri Feb 02 07:43:54 2018 -0500
@@ -59,7 +59,9 @@
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.util.JCDiagnostic.Error;
import com.sun.tools.javac.util.JCDiagnostic.Fragment;
+import com.sun.tools.javac.util.JCDiagnostic.Warning;
import com.sun.tools.javac.util.List;
import static com.sun.tools.javac.code.Flags.*;
@@ -1417,7 +1419,7 @@
if (!pattype.hasTag(ERROR)) {
if (pattype.constValue() == null) {
log.error(c.pat.pos(),
- (stringSwitch ? "string.const.req" : "const.expr.req"));
+ (stringSwitch ? Errors.StringConstReq : Errors.ConstExprReq));
} else if (!labels.add(pattype.constValue())) {
log.error(c.pos(), Errors.DuplicateCaseLabel);
}
@@ -3675,8 +3677,7 @@
sym.name != names._class) {
// If the qualified item is not a type and the selected item is static, report
// a warning. Make allowance for the class of an array type e.g. Object[].class)
- chk.warnStatic(tree, "static.not.qualified.by.type",
- sym.kind.kindName(), sym.owner);
+ chk.warnStatic(tree, Warnings.StaticNotQualifiedByType(sym.kind.kindName(), sym.owner));
}
// If we are selecting an instance member via a `super', ...
@@ -3925,9 +3926,7 @@
if (s != null &&
s.isRaw() &&
!types.isSameType(v.type, v.erasure(types))) {
- chk.warnUnchecked(tree.pos(),
- "unchecked.assign.to.var",
- v, s);
+ chk.warnUnchecked(tree.pos(), Warnings.UncheckedAssignToVar(v, s));
}
}
// The computed type of a variable is the type of the
@@ -4002,12 +4001,14 @@
((v.flags() & STATIC) != 0) == Resolve.isStatic(env) &&
(!env.tree.hasTag(ASSIGN) ||
TreeInfo.skipParens(((JCAssign) env.tree).lhs) != tree)) {
- String suffix = (initEnv.info.enclVar == v) ?
- "self.ref" : "forward.ref";
if (!onlyWarning || isStaticEnumField(v)) {
- log.error(tree.pos(), "illegal." + suffix);
+ Error errkey = (initEnv.info.enclVar == v) ?
+ Errors.IllegalSelfRef : Errors.IllegalForwardRef;
+ log.error(tree.pos(), errkey);
} else if (useBeforeDeclarationWarning) {
- log.warning(tree.pos(), suffix, v);
+ Warning warnkey = (initEnv.info.enclVar == v) ?
+ Warnings.SelfRef(v) : Warnings.ForwardRef(v);
+ log.warning(tree.pos(), warnkey);
}
}
@@ -4117,9 +4118,7 @@
if (s != null && s.isRaw() &&
!types.isSameTypes(sym.type.getParameterTypes(),
sym.erasure(types).getParameterTypes())) {
- chk.warnUnchecked(env.tree.pos(),
- "unchecked.call.mbr.of.raw.type",
- sym, s);
+ chk.warnUnchecked(env.tree.pos(), Warnings.UncheckedCallMbrOfRawType(sym, s));
}
}
@@ -4169,14 +4168,12 @@
argtypes = argtypes.map(checkDeferredMap);
if (noteWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
- chk.warnUnchecked(env.tree.pos(),
- "unchecked.meth.invocation.applied",
- kindName(sym),
+ chk.warnUnchecked(env.tree.pos(), Warnings.UncheckedMethInvocationApplied(kindName(sym),
sym.name,
rs.methodArguments(sym.type.getParameterTypes()),
rs.methodArguments(argtypes.map(checkDeferredMap)),
kindName(sym.location()),
- sym.location());
+ sym.location()));
if (resultInfo.pt != Infer.anyPoly ||
!owntype.hasTag(METHOD) ||
!owntype.isPartial()) {