Tue, 05 Aug 2008 12:54:40 +0100
6730423: Diagnostic formatter should be an instance field of JCDiagnostic
Summary: JCDiagnostic.fragment should be deprecated and the diagnostic factory should be used instead
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Aug 04 17:54:15 2008 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Aug 05 12:54:40 2008 +0100 1.3 @@ -79,6 +79,7 @@ 1.4 final Enter enter; 1.5 final Target target; 1.6 final Types types; 1.7 + final JCDiagnostic.Factory diags; 1.8 final Annotate annotate; 1.9 1.10 public static Attr instance(Context context) { 1.11 @@ -102,6 +103,7 @@ 1.12 cfolder = ConstFold.instance(context); 1.13 target = Target.instance(context); 1.14 types = Types.instance(context); 1.15 + diags = JCDiagnostic.Factory.instance(context); 1.16 annotate = Annotate.instance(context); 1.17 1.18 Options options = Options.instance(context); 1.19 @@ -2419,7 +2421,7 @@ 1.20 1.21 if (false) { 1.22 // TODO: make assertConvertible work 1.23 - chk.typeError(tree.pos(), JCDiagnostic.fragment("incompatible.types"), actual, formal); 1.24 + chk.typeError(tree.pos(), diags.fragment("incompatible.types"), actual, formal); 1.25 throw new AssertionError("Tree: " + tree 1.26 + " actual:" + actual 1.27 + " formal: " + formal);
2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Aug 04 17:54:15 2008 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Aug 05 12:54:40 2008 +0100 2.3 @@ -63,6 +63,7 @@ 2.4 private final Target target; 2.5 private final Source source; 2.6 private final Types types; 2.7 + private final JCDiagnostic.Factory diags; 2.8 private final boolean skipAnnotations; 2.9 private final TreeInfo treeinfo; 2.10 2.11 @@ -86,6 +87,7 @@ 2.12 syms = Symtab.instance(context); 2.13 infer = Infer.instance(context); 2.14 this.types = Types.instance(context); 2.15 + diags = JCDiagnostic.Factory.instance(context); 2.16 Options options = Options.instance(context); 2.17 target = Target.instance(context); 2.18 source = Source.instance(context); 2.19 @@ -343,7 +345,7 @@ 2.20 if (types.isAssignable(found, req, convertWarner(pos, found, req))) 2.21 return found; 2.22 if (found.tag <= DOUBLE && req.tag <= DOUBLE) 2.23 - return typeError(pos, JCDiagnostic.fragment("possible.loss.of.precision"), found, req); 2.24 + return typeError(pos, diags.fragment("possible.loss.of.precision"), found, req); 2.25 if (found.isSuperBound()) { 2.26 log.error(pos, "assignment.from.super-bound", found); 2.27 return syms.errType; 2.28 @@ -352,7 +354,7 @@ 2.29 log.error(pos, "assignment.to.extends-bound", req); 2.30 return syms.errType; 2.31 } 2.32 - return typeError(pos, JCDiagnostic.fragment("incompatible.types"), found, req); 2.33 + return typeError(pos, diags.fragment("incompatible.types"), found, req); 2.34 } 2.35 2.36 /** Instantiate polymorphic type to some prototype, unless 2.37 @@ -380,7 +382,7 @@ 2.38 } else { 2.39 JCDiagnostic d = ex.getDiagnostic(); 2.40 return typeError(pos, 2.41 - JCDiagnostic.fragment("incompatible.types" + (d!=null ? ".1" : ""), d), 2.42 + diags.fragment("incompatible.types" + (d!=null ? ".1" : ""), d), 2.43 t, pt); 2.44 } 2.45 } 2.46 @@ -401,7 +403,7 @@ 2.47 return req; 2.48 } else { 2.49 return typeError(pos, 2.50 - JCDiagnostic.fragment("inconvertible.types"), 2.51 + diags.fragment("inconvertible.types"), 2.52 found, req); 2.53 } 2.54 } 2.55 @@ -480,9 +482,9 @@ 2.56 Type checkClassType(DiagnosticPosition pos, Type t) { 2.57 if (t.tag != CLASS && t.tag != ERROR) 2.58 return typeTagError(pos, 2.59 - JCDiagnostic.fragment("type.req.class"), 2.60 + diags.fragment("type.req.class"), 2.61 (t.tag == TYPEVAR) 2.62 - ? JCDiagnostic.fragment("type.parameter", t) 2.63 + ? diags.fragment("type.parameter", t) 2.64 : t); 2.65 else 2.66 return t; 2.67 @@ -515,7 +517,7 @@ 2.68 Type checkReifiableReferenceType(DiagnosticPosition pos, Type t) { 2.69 if (t.tag != CLASS && t.tag != ARRAY && t.tag != ERROR) { 2.70 return typeTagError(pos, 2.71 - JCDiagnostic.fragment("type.req.class.array"), 2.72 + diags.fragment("type.req.class.array"), 2.73 t); 2.74 } else if (!types.isReifiable(t)) { 2.75 log.error(pos, "illegal.generic.type.for.instof"); 2.76 @@ -540,7 +542,7 @@ 2.77 return t; 2.78 default: 2.79 return typeTagError(pos, 2.80 - JCDiagnostic.fragment("type.req.ref"), 2.81 + diags.fragment("type.req.ref"), 2.82 t); 2.83 } 2.84 } 2.85 @@ -560,7 +562,7 @@ 2.86 return t; 2.87 default: 2.88 return typeTagError(pos, 2.89 - JCDiagnostic.fragment("type.req.ref"), 2.90 + diags.fragment("type.req.ref"), 2.91 t); 2.92 } 2.93 } 2.94 @@ -1028,7 +1030,7 @@ 2.95 * @param other The overridden method. 2.96 * @return An internationalized string. 2.97 */ 2.98 - static Object cannotOverride(MethodSymbol m, MethodSymbol other) { 2.99 + Object cannotOverride(MethodSymbol m, MethodSymbol other) { 2.100 String key; 2.101 if ((other.owner.flags() & INTERFACE) == 0) 2.102 key = "cant.override"; 2.103 @@ -1036,7 +1038,7 @@ 2.104 key = "cant.implement"; 2.105 else 2.106 key = "clashes.with"; 2.107 - return JCDiagnostic.fragment(key, m, m.location(), other, other.location()); 2.108 + return diags.fragment(key, m, m.location(), other, other.location()); 2.109 } 2.110 2.111 /** A customized "override" warning message. 2.112 @@ -1044,7 +1046,7 @@ 2.113 * @param other The overridden method. 2.114 * @return An internationalized string. 2.115 */ 2.116 - static Object uncheckedOverrides(MethodSymbol m, MethodSymbol other) { 2.117 + Object uncheckedOverrides(MethodSymbol m, MethodSymbol other) { 2.118 String key; 2.119 if ((other.owner.flags() & INTERFACE) == 0) 2.120 key = "unchecked.override"; 2.121 @@ -1052,7 +1054,7 @@ 2.122 key = "unchecked.implement"; 2.123 else 2.124 key = "unchecked.clash.with"; 2.125 - return JCDiagnostic.fragment(key, m, m.location(), other, other.location()); 2.126 + return diags.fragment(key, m, m.location(), other, other.location()); 2.127 } 2.128 2.129 /** A customized "override" warning message. 2.130 @@ -1060,7 +1062,7 @@ 2.131 * @param other The overridden method. 2.132 * @return An internationalized string. 2.133 */ 2.134 - static Object varargsOverrides(MethodSymbol m, MethodSymbol other) { 2.135 + Object varargsOverrides(MethodSymbol m, MethodSymbol other) { 2.136 String key; 2.137 if ((other.owner.flags() & INTERFACE) == 0) 2.138 key = "varargs.override"; 2.139 @@ -1068,7 +1070,7 @@ 2.140 key = "varargs.implement"; 2.141 else 2.142 key = "varargs.clash.with"; 2.143 - return JCDiagnostic.fragment(key, m, m.location(), other, other.location()); 2.144 + return diags.fragment(key, m, m.location(), other, other.location()); 2.145 } 2.146 2.147 /** Check that this method conforms with overridden method 'other'. 2.148 @@ -1157,7 +1159,7 @@ 2.149 // allow limited interoperability with covariant returns 2.150 } else { 2.151 typeError(TreeInfo.diagnosticPositionFor(m, tree), 2.152 - JCDiagnostic.fragment("override.incompatible.ret", 2.153 + diags.fragment("override.incompatible.ret", 2.154 cannotOverride(m, other)), 2.155 mtres, otres); 2.156 return; 2.157 @@ -1165,7 +1167,7 @@ 2.158 } else if (overrideWarner.warned) { 2.159 warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree), 2.160 "prob.found.req", 2.161 - JCDiagnostic.fragment("override.unchecked.ret", 2.162 + diags.fragment("override.unchecked.ret", 2.163 uncheckedOverrides(m, other)), 2.164 mtres, otres); 2.165 } 2.166 @@ -2170,7 +2172,7 @@ 2.167 boolean warned = this.warned; 2.168 super.warnUnchecked(); 2.169 if (warned) return; // suppress redundant diagnostics 2.170 - Object problem = JCDiagnostic.fragment(key); 2.171 + Object problem = diags.fragment(key); 2.172 Check.this.warnUnchecked(pos(), "prob.found.req", problem, found, expected); 2.173 } 2.174 }
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Mon Aug 04 17:54:15 2008 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Aug 05 12:54:40 2008 +0100 3.3 @@ -29,6 +29,7 @@ 3.4 import com.sun.tools.javac.util.List; 3.5 import com.sun.tools.javac.code.*; 3.6 import com.sun.tools.javac.code.Type.*; 3.7 +import com.sun.tools.javac.util.JCDiagnostic; 3.8 3.9 import static com.sun.tools.javac.code.Flags.*; 3.10 import static com.sun.tools.javac.code.Kinds.*; 3.11 @@ -50,6 +51,7 @@ 3.12 3.13 Symtab syms; 3.14 Types types; 3.15 + JCDiagnostic.Factory diags; 3.16 3.17 public static Infer instance(Context context) { 3.18 Infer instance = context.get(inferKey); 3.19 @@ -62,6 +64,11 @@ 3.20 context.put(inferKey, this); 3.21 syms = Symtab.instance(context); 3.22 types = Types.instance(context); 3.23 + diags = JCDiagnostic.Factory.instance(context); 3.24 + ambiguousNoInstanceException = 3.25 + new NoInstanceException(true, diags); 3.26 + unambiguousNoInstanceException = 3.27 + new NoInstanceException(false, diags); 3.28 } 3.29 3.30 public static class NoInstanceException extends RuntimeException { 3.31 @@ -70,35 +77,35 @@ 3.32 boolean isAmbiguous; // exist several incomparable best instances? 3.33 3.34 JCDiagnostic diagnostic; 3.35 + JCDiagnostic.Factory diags; 3.36 3.37 - NoInstanceException(boolean isAmbiguous) { 3.38 + NoInstanceException(boolean isAmbiguous, JCDiagnostic.Factory diags) { 3.39 this.diagnostic = null; 3.40 this.isAmbiguous = isAmbiguous; 3.41 + this.diags = diags; 3.42 } 3.43 NoInstanceException setMessage(String key) { 3.44 - this.diagnostic = JCDiagnostic.fragment(key); 3.45 + this.diagnostic = diags.fragment(key); 3.46 return this; 3.47 } 3.48 NoInstanceException setMessage(String key, Object arg1) { 3.49 - this.diagnostic = JCDiagnostic.fragment(key, arg1); 3.50 + this.diagnostic = diags.fragment(key, arg1); 3.51 return this; 3.52 } 3.53 NoInstanceException setMessage(String key, Object arg1, Object arg2) { 3.54 - this.diagnostic = JCDiagnostic.fragment(key, arg1, arg2); 3.55 + this.diagnostic = diags.fragment(key, arg1, arg2); 3.56 return this; 3.57 } 3.58 NoInstanceException setMessage(String key, Object arg1, Object arg2, Object arg3) { 3.59 - this.diagnostic = JCDiagnostic.fragment(key, arg1, arg2, arg3); 3.60 + this.diagnostic = diags.fragment(key, arg1, arg2, arg3); 3.61 return this; 3.62 } 3.63 public JCDiagnostic getDiagnostic() { 3.64 return diagnostic; 3.65 } 3.66 } 3.67 - private final NoInstanceException ambiguousNoInstanceException = 3.68 - new NoInstanceException(true); 3.69 - private final NoInstanceException unambiguousNoInstanceException = 3.70 - new NoInstanceException(false); 3.71 + private final NoInstanceException ambiguousNoInstanceException; 3.72 + private final NoInstanceException unambiguousNoInstanceException; 3.73 3.74 /*************************************************************************** 3.75 * Auxiliary type values and classes
4.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Mon Aug 04 17:54:15 2008 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Aug 05 12:54:40 2008 +0100 4.3 @@ -72,6 +72,7 @@ 4.4 private final Todo todo; 4.5 private final Annotate annotate; 4.6 private final Types types; 4.7 + private final JCDiagnostic.Factory diags; 4.8 private final Target target; 4.9 4.10 private final boolean skipAnnotations; 4.11 @@ -96,6 +97,7 @@ 4.12 todo = Todo.instance(context); 4.13 annotate = Annotate.instance(context); 4.14 types = Types.instance(context); 4.15 + diags = JCDiagnostic.Factory.instance(context); 4.16 target = Target.instance(context); 4.17 skipAnnotations = 4.18 Options.instance(context).get("skipAnnotations") != null; 4.19 @@ -133,7 +135,7 @@ 4.20 if (tsym.kind == PCK && tsym.members().elems == null && !tsym.exists()) { 4.21 // If we can't find java.lang, exit immediately. 4.22 if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) { 4.23 - JCDiagnostic msg = JCDiagnostic.fragment("fatal.err.no.java.lang"); 4.24 + JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang"); 4.25 throw new FatalError(msg); 4.26 } else { 4.27 log.error(pos, "doesnt.exist", tsym); 4.28 @@ -319,7 +321,7 @@ 4.29 log.error(pos, "cant.resolve.location", 4.30 KindName.STATIC, 4.31 name, List.<Type>nil(), List.<Type>nil(), 4.32 - typeKindName(tsym.type), 4.33 + Kinds.typeKindName(tsym.type), 4.34 tsym.type); 4.35 } 4.36 } finally {
5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Aug 04 17:54:15 2008 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Aug 05 12:54:40 2008 +0100 5.3 @@ -59,6 +59,7 @@ 5.4 ClassReader reader; 5.5 TreeInfo treeinfo; 5.6 Types types; 5.7 + JCDiagnostic.Factory diags; 5.8 public final boolean boxingEnabled; // = source.allowBoxing(); 5.9 public final boolean varargsEnabled; // = source.allowVarargs(); 5.10 private final boolean debugResolve; 5.11 @@ -92,6 +93,7 @@ 5.12 reader = ClassReader.instance(context); 5.13 treeinfo = TreeInfo.instance(context); 5.14 types = Types.instance(context); 5.15 + diags = JCDiagnostic.Factory.instance(context); 5.16 Source source = Source.instance(context); 5.17 boxingEnabled = source.allowBoxing(); 5.18 varargsEnabled = source.allowVarargs(); 5.19 @@ -449,7 +451,7 @@ 5.20 Symbol sym = findField(env, site, name, site.tsym); 5.21 if (sym.kind == VAR) return (VarSymbol)sym; 5.22 else throw new FatalError( 5.23 - JCDiagnostic.fragment("fatal.err.cant.locate.field", 5.24 + diags.fragment("fatal.err.cant.locate.field", 5.25 name)); 5.26 } 5.27 5.28 @@ -1248,7 +1250,7 @@ 5.29 pos, env, site, name, argtypes, typeargtypes); 5.30 if (sym.kind == MTH) return (MethodSymbol)sym; 5.31 else throw new FatalError( 5.32 - JCDiagnostic.fragment("fatal.err.cant.locate.meth", 5.33 + diags.fragment("fatal.err.cant.locate.meth", 5.34 name)); 5.35 } 5.36 5.37 @@ -1320,7 +1322,7 @@ 5.38 pos, env, site, argtypes, typeargtypes); 5.39 if (sym.kind == MTH) return (MethodSymbol)sym; 5.40 else throw new FatalError( 5.41 - JCDiagnostic.fragment("fatal.err.cant.locate.ctor", site)); 5.42 + diags.fragment("fatal.err.cant.locate.ctor", site)); 5.43 } 5.44 5.45 /** Resolve operator.
6.1 --- a/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java Mon Aug 04 17:54:15 2008 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java Tue Aug 05 12:54:40 2008 +0100 6.3 @@ -59,20 +59,19 @@ 6.4 return instance; 6.5 } 6.6 6.7 - final Messages messages; 6.8 + DiagnosticFormatter<JCDiagnostic> formatter; 6.9 final String prefix; 6.10 6.11 /** Create a new diagnostic factory. */ 6.12 protected Factory(Context context) { 6.13 + this(Messages.instance(context), "compiler"); 6.14 context.put(diagnosticFactoryKey, this); 6.15 - messages = Messages.instance(context); 6.16 - prefix = "compiler"; 6.17 } 6.18 6.19 /** Create a new diagnostic factory. */ 6.20 public Factory(Messages messages, String prefix) { 6.21 - this.messages = messages; 6.22 this.prefix = prefix; 6.23 + this.formatter = new BasicDiagnosticFormatter(messages); 6.24 } 6.25 6.26 /** 6.27 @@ -84,7 +83,7 @@ 6.28 */ 6.29 public JCDiagnostic error( 6.30 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { 6.31 - return new JCDiagnostic(messages, ERROR, true, source, pos, qualify(ERROR, key), args); 6.32 + return new JCDiagnostic(formatter, ERROR, true, source, pos, qualify(ERROR, key), args); 6.33 } 6.34 6.35 /** 6.36 @@ -97,7 +96,7 @@ 6.37 */ 6.38 public JCDiagnostic mandatoryWarning( 6.39 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { 6.40 - return new JCDiagnostic(messages, WARNING, true, source, pos, qualify(WARNING, key), args); 6.41 + return new JCDiagnostic(formatter, WARNING, true, source, pos, qualify(WARNING, key), args); 6.42 } 6.43 6.44 /** 6.45 @@ -109,7 +108,7 @@ 6.46 */ 6.47 public JCDiagnostic warning( 6.48 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { 6.49 - return new JCDiagnostic(messages, WARNING, false, source, pos, qualify(WARNING, key), args); 6.50 + return new JCDiagnostic(formatter, WARNING, false, source, pos, qualify(WARNING, key), args); 6.51 } 6.52 6.53 /** 6.54 @@ -119,7 +118,7 @@ 6.55 * @see MandatoryWarningHandler 6.56 */ 6.57 public JCDiagnostic mandatoryNote(DiagnosticSource source, String key, Object... args) { 6.58 - return new JCDiagnostic(messages, NOTE, true, source, null, qualify(NOTE, key), args); 6.59 + return new JCDiagnostic(formatter, NOTE, true, source, null, qualify(NOTE, key), args); 6.60 } 6.61 6.62 /** 6.63 @@ -140,7 +139,7 @@ 6.64 */ 6.65 public JCDiagnostic note( 6.66 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { 6.67 - return new JCDiagnostic(messages, NOTE, false, source, pos, qualify(NOTE, key), args); 6.68 + return new JCDiagnostic(formatter, NOTE, false, source, pos, qualify(NOTE, key), args); 6.69 } 6.70 6.71 /** 6.72 @@ -149,7 +148,7 @@ 6.73 * @param args Fields of the error message. 6.74 */ 6.75 public JCDiagnostic fragment(String key, Object... args) { 6.76 - return new JCDiagnostic(messages, FRAGMENT, false, null, null, qualify(FRAGMENT, key), args); 6.77 + return new JCDiagnostic(formatter, FRAGMENT, false, null, null, qualify(FRAGMENT, key), args); 6.78 } 6.79 6.80 protected String qualify(DiagnosticType t, String key) { 6.81 @@ -163,10 +162,11 @@ 6.82 * Create a fragment diagnostic, for use as an argument in other diagnostics 6.83 * @param key The key for the localized error message. 6.84 * @param args Fields of the error message. 6.85 + * 6.86 */ 6.87 - // should be deprecated 6.88 + @Deprecated 6.89 public static JCDiagnostic fragment(String key, Object... args) { 6.90 - return new JCDiagnostic(Messages.getDefaultMessages(), 6.91 + return new JCDiagnostic(getFragmentFormatter(), 6.92 FRAGMENT, 6.93 false, 6.94 null, 6.95 @@ -174,6 +174,14 @@ 6.96 "compiler." + FRAGMENT.key + "." + key, 6.97 args); 6.98 } 6.99 + //where 6.100 + @Deprecated 6.101 + public static DiagnosticFormatter<JCDiagnostic> getFragmentFormatter() { 6.102 + if (fragmentFormatter == null) { 6.103 + fragmentFormatter = new BasicDiagnosticFormatter(Messages.getDefaultMessages()); 6.104 + } 6.105 + return fragmentFormatter; 6.106 + } 6.107 6.108 /** 6.109 * A DiagnosticType defines the type of the diagnostic. 6.110 @@ -247,7 +255,6 @@ 6.111 private final int pos; 6.112 } 6.113 6.114 - private final Messages messages; 6.115 private final DiagnosticType type; 6.116 private final DiagnosticSource source; 6.117 private final DiagnosticPosition position; 6.118 @@ -266,7 +273,7 @@ 6.119 * @param key a resource key to identify the text of the diagnostic 6.120 * @param args arguments to be included in the text of the diagnostic 6.121 */ 6.122 - protected JCDiagnostic(Messages messages, 6.123 + protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter, 6.124 DiagnosticType dt, 6.125 boolean mandatory, 6.126 DiagnosticSource source, 6.127 @@ -276,7 +283,7 @@ 6.128 if (source == null && pos != null && pos.getPreferredPosition() != Position.NOPOS) 6.129 throw new IllegalArgumentException(); 6.130 6.131 - this.messages = messages; 6.132 + this.defaultFormatter = formatter; 6.133 this.type = dt; 6.134 this.mandatory = mandatory; 6.135 this.source = source; 6.136 @@ -398,25 +405,19 @@ 6.137 * @return the prefix string associated with a particular type of diagnostic 6.138 */ 6.139 public String getPrefix(DiagnosticType dt) { 6.140 - return getFormatter().formatKind(this, Locale.getDefault()); 6.141 + return defaultFormatter.formatKind(this, Locale.getDefault()); 6.142 } 6.143 6.144 - private DiagnosticFormatter<JCDiagnostic> getFormatter() { 6.145 - if (defaultFormatter == null) { 6.146 - defaultFormatter = new BasicDiagnosticFormatter(messages); 6.147 - } 6.148 - return defaultFormatter; 6.149 - } 6.150 - 6.151 - 6.152 /** 6.153 * Return the standard presentation of this diagnostic. 6.154 */ 6.155 public String toString() { 6.156 - return getFormatter().format(this,Locale.getDefault()); 6.157 + return defaultFormatter.format(this,Locale.getDefault()); 6.158 } 6.159 6.160 - private static DiagnosticFormatter<JCDiagnostic> defaultFormatter; 6.161 + private DiagnosticFormatter<JCDiagnostic> defaultFormatter; 6.162 + @Deprecated 6.163 + private static DiagnosticFormatter<JCDiagnostic> fragmentFormatter; 6.164 6.165 // Methods for javax.tools.Diagnostic 6.166 6.167 @@ -440,6 +441,6 @@ 6.168 6.169 public String getMessage(Locale locale) { 6.170 // RFE 6406133: JCDiagnostic.getMessage ignores locale argument 6.171 - return getFormatter().formatMessage(this, locale); 6.172 + return defaultFormatter.formatMessage(this, locale); 6.173 } 6.174 }