Thu, 05 Mar 2009 17:25:37 +0000
6799605: Basic/Raw formatters should use type/symbol printer instead of toString()
Summary: create new combo type/symbol visitor printer used by all diagnostic formatters
Reviewed-by: jjg
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Mar 05 17:25:37 2009 +0000 1.3 @@ -0,0 +1,324 @@ 1.4 +/* 1.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package com.sun.tools.javac.code; 1.30 + 1.31 +import java.util.Locale; 1.32 + 1.33 +import com.sun.tools.javac.api.Messages; 1.34 +import com.sun.tools.javac.code.Type.*; 1.35 +import com.sun.tools.javac.code.Symbol.*; 1.36 +import com.sun.tools.javac.util.List; 1.37 +import com.sun.tools.javac.util.ListBuffer; 1.38 + 1.39 +import static com.sun.tools.javac.code.TypeTags.*; 1.40 +import static com.sun.tools.javac.code.BoundKind.*; 1.41 +import static com.sun.tools.javac.code.Flags.*; 1.42 + 1.43 +/** 1.44 + * A combined type/symbol visitor for generating non-trivial localized string 1.45 + * representation of types and symbols. 1.46 + */ 1.47 +public abstract class Printer implements Type.Visitor<String, Locale>, Symbol.Visitor<String, Locale> { 1.48 + 1.49 + /** 1.50 + * This method should be overriden in order to provide proper i18n support. 1.51 + * 1.52 + * @param locale the locale in which the string is to be rendered 1.53 + * @param key the key corresponding to the message to be displayed 1.54 + * @param args a list of optional arguments 1.55 + * @return localized string representation 1.56 + */ 1.57 + protected abstract String localize(Locale locale, String key, Object... args); 1.58 + 1.59 + /** 1.60 + * Create a printer with default i18n support provided my Messages. 1.61 + * @param messages Messages class to be used for i18n 1.62 + * @return printer visitor instance 1.63 + */ 1.64 + public static Printer createStandardPrinter(final Messages messages) { 1.65 + return new Printer() { 1.66 + @Override 1.67 + protected String localize(Locale locale, String key, Object... args) { 1.68 + return messages.getLocalizedString(locale, key, args); 1.69 + }}; 1.70 + } 1.71 + 1.72 + /** 1.73 + * Get a localized string representation for all the types in the input list. 1.74 + * 1.75 + * @param ts types to be displayed 1.76 + * @param locale the locale in which the string is to be rendered 1.77 + * @return localized string representation 1.78 + */ 1.79 + public String visitTypes(List<Type> ts, Locale locale) { 1.80 + ListBuffer<String> sbuf = ListBuffer.lb(); 1.81 + for (Type t : ts) { 1.82 + sbuf.append(visit(t, locale)); 1.83 + } 1.84 + return sbuf.toList().toString(); 1.85 + } 1.86 + 1.87 + /** 1.88 + * * Get a localized string represenation for all the symbols in the input list. 1.89 + * 1.90 + * @param ts symbols to be displayed 1.91 + * @param locale the locale in which the string is to be rendered 1.92 + * @return localized string representation 1.93 + */ 1.94 + public String visitSymbols(List<Symbol> ts, Locale locale) { 1.95 + ListBuffer<String> sbuf = ListBuffer.lb(); 1.96 + for (Symbol t : ts) { 1.97 + sbuf.append(visit(t, locale)); 1.98 + } 1.99 + return sbuf.toList().toString(); 1.100 + } 1.101 + 1.102 + /** 1.103 + * Get a localized string represenation for a given type. 1.104 + * 1.105 + * @param ts type to be displayed 1.106 + * @param locale the locale in which the string is to be rendered 1.107 + * @return localized string representation 1.108 + */ 1.109 + public String visit(Type t, Locale locale) { 1.110 + return t.accept(this, locale); 1.111 + } 1.112 + 1.113 + /** 1.114 + * Get a localized string represenation for a given symbol. 1.115 + * 1.116 + * @param ts symbol to be displayed 1.117 + * @param locale the locale in which the string is to be rendered 1.118 + * @return localized string representation 1.119 + */ 1.120 + public String visit(Symbol s, Locale locale) { 1.121 + return s.accept(this, locale); 1.122 + } 1.123 + 1.124 + @Override 1.125 + public String visitCapturedType(CapturedType t, Locale locale) { 1.126 + return localize(locale, "compiler.misc.type.captureof", 1.127 + (t.hashCode() & 0xFFFFFFFFL) % Type.CapturedType.PRIME, 1.128 + visit(t.wildcard, locale)); 1.129 + } 1.130 + 1.131 + @Override 1.132 + public String visitForAll(ForAll t, Locale locale) { 1.133 + return "<" + visitTypes(t.tvars, locale) + ">" + visit(t.qtype, locale); 1.134 + } 1.135 + 1.136 + @Override 1.137 + public String visitUndetVar(UndetVar t, Locale locale) { 1.138 + if (t.inst != null) { 1.139 + return visit(t.inst, locale); 1.140 + } else { 1.141 + return visit(t.qtype, locale) + "?"; 1.142 + } 1.143 + } 1.144 + 1.145 + @Override 1.146 + public String visitArrayType(ArrayType t, Locale locale) { 1.147 + return visit(t.elemtype, locale) + "[]"; 1.148 + } 1.149 + 1.150 + @Override 1.151 + public String visitClassType(ClassType t, Locale locale) { 1.152 + StringBuffer buf = new StringBuffer(); 1.153 + if (t.getEnclosingType().tag == CLASS && t.tsym.owner.kind == Kinds.TYP) { 1.154 + buf.append(visit(t.getEnclosingType(), locale)); 1.155 + buf.append("."); 1.156 + buf.append(className(t, false, locale)); 1.157 + } else { 1.158 + buf.append(className(t, true, locale)); 1.159 + } 1.160 + if (t.getTypeArguments().nonEmpty()) { 1.161 + buf.append('<'); 1.162 + buf.append(visitTypes(t.getTypeArguments(), locale)); 1.163 + buf.append(">"); 1.164 + } 1.165 + return buf.toString(); 1.166 + } 1.167 + 1.168 + @Override 1.169 + public String visitMethodType(MethodType t, Locale locale) { 1.170 + return "(" + printMethodArgs(t.argtypes, false, locale) + ")" + visit(t.restype, locale); 1.171 + } 1.172 + 1.173 + @Override 1.174 + public String visitPackageType(PackageType t, Locale locale) { 1.175 + return t.tsym.getQualifiedName().toString(); 1.176 + } 1.177 + 1.178 + @Override 1.179 + public String visitWildcardType(WildcardType t, Locale locale) { 1.180 + StringBuffer s = new StringBuffer(); 1.181 + s.append(t.kind); 1.182 + if (t.kind != UNBOUND) { 1.183 + s.append(visit(t.type, locale)); 1.184 + } 1.185 + return s.toString(); 1.186 + } 1.187 + 1.188 + @Override 1.189 + public String visitErrorType(ErrorType t, Locale locale) { 1.190 + return visitType(t, locale); 1.191 + } 1.192 + 1.193 + @Override 1.194 + public String visitTypeVar(TypeVar t, Locale locale) { 1.195 + return visitType(t, locale); 1.196 + } 1.197 + 1.198 + public String visitType(Type t, Locale locale) { 1.199 + String s = (t.tsym == null || t.tsym.name == null) 1.200 + ? localize(locale, "compiler.misc.type.none") 1.201 + : t.tsym.name.toString(); 1.202 + return s; 1.203 + } 1.204 + 1.205 + /** 1.206 + * Converts a class name into a (possibly localized) string. Anonymous 1.207 + * inner classes gets converted into a localized string. 1.208 + * 1.209 + * @param t the type of the class whose name is to be rendered 1.210 + * @param longform if set, the class' fullname is displayed - if unset the 1.211 + * short name is chosen (w/o package) 1.212 + * @param locale the locale in which the string is to be rendered 1.213 + * @return localized string representation 1.214 + */ 1.215 + protected String className(ClassType t, boolean longform, Locale locale) { 1.216 + Symbol sym = t.tsym; 1.217 + if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) { 1.218 + StringBuffer s = new StringBuffer(visit(t.supertype_field, locale)); 1.219 + for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) { 1.220 + s.append("&"); 1.221 + s.append(visit(is.head, locale)); 1.222 + } 1.223 + return s.toString(); 1.224 + } else if (sym.name.length() == 0) { 1.225 + String s; 1.226 + ClassType norm = (ClassType) t.tsym.type; 1.227 + if (norm == null) { 1.228 + s = localize(locale, "compiler.misc.anonymous.class", (Object) null); 1.229 + } else if (norm.interfaces_field.nonEmpty()) { 1.230 + s = localize(locale, "compiler.misc.anonymous.class", 1.231 + visit(norm.interfaces_field.head, locale)); 1.232 + } else { 1.233 + s = localize(locale, "compiler.misc.anonymous.class", 1.234 + visit(norm.supertype_field, locale)); 1.235 + } 1.236 + return s; 1.237 + } else if (longform) { 1.238 + return sym.getQualifiedName().toString(); 1.239 + } else { 1.240 + return sym.name.toString(); 1.241 + } 1.242 + } 1.243 + 1.244 + /** 1.245 + * Converts a set of method argument types into their corresponding 1.246 + * localized string representation. 1.247 + * 1.248 + * @param args arguments to be rendered 1.249 + * @param varArgs if true, the last method argument is regarded as a vararg 1.250 + * @param locale the locale in which the string is to be rendered 1.251 + * @return localized string representation 1.252 + */ 1.253 + protected String printMethodArgs(List<Type> args, boolean varArgs, Locale locale) { 1.254 + if (!varArgs) { 1.255 + return visitTypes(args, locale); 1.256 + } else { 1.257 + StringBuffer buf = new StringBuffer(); 1.258 + while (args.tail.nonEmpty()) { 1.259 + buf.append(visit(args.head, locale)); 1.260 + args = args.tail; 1.261 + buf.append(','); 1.262 + } 1.263 + if (args.head.tag == ARRAY) { 1.264 + buf.append(visit(((ArrayType) args.head).elemtype, locale)); 1.265 + buf.append("..."); 1.266 + } else { 1.267 + buf.append(visit(args.head, locale)); 1.268 + } 1.269 + return buf.toString(); 1.270 + } 1.271 + } 1.272 + 1.273 + @Override 1.274 + public String visitClassSymbol(ClassSymbol sym, Locale locale) { 1.275 + return sym.name.isEmpty() 1.276 + ? localize(locale, "compiler.misc.anonymous.class", sym.flatname) 1.277 + : sym.fullname.toString(); 1.278 + } 1.279 + 1.280 + @Override 1.281 + public String visitMethodSymbol(MethodSymbol s, Locale locale) { 1.282 + if ((s.flags() & BLOCK) != 0) { 1.283 + return s.owner.name.toString(); 1.284 + } else { 1.285 + String ms = (s.name == s.name.table.names.init) 1.286 + ? s.owner.name.toString() 1.287 + : s.name.toString(); 1.288 + if (s.type != null) { 1.289 + if (s.type.tag == FORALL) { 1.290 + ms = "<" + visitTypes(s.type.getTypeArguments(), locale) + ">" + ms; 1.291 + } 1.292 + ms += "(" + printMethodArgs( 1.293 + s.type.getParameterTypes(), 1.294 + (s.flags() & VARARGS) != 0, 1.295 + locale) + ")"; 1.296 + } 1.297 + return ms; 1.298 + } 1.299 + } 1.300 + 1.301 + @Override 1.302 + public String visitOperatorSymbol(OperatorSymbol s, Locale locale) { 1.303 + return visitMethodSymbol(s, locale); 1.304 + } 1.305 + 1.306 + @Override 1.307 + public String visitPackageSymbol(PackageSymbol s, Locale locale) { 1.308 + return s.isUnnamed() 1.309 + ? localize(locale, "compiler.misc.unnamed.package") 1.310 + : s.fullname.toString(); 1.311 + } 1.312 + 1.313 + @Override 1.314 + public String visitTypeSymbol(TypeSymbol s, Locale locale) { 1.315 + return visitSymbol(s, locale); 1.316 + } 1.317 + 1.318 + @Override 1.319 + public String visitVarSymbol(VarSymbol s, Locale locale) { 1.320 + return visitSymbol(s, locale); 1.321 + } 1.322 + 1.323 + @Override 1.324 + public String visitSymbol(Symbol s, Locale locale) { 1.325 + return s.name.toString(); 1.326 + } 1.327 +}
2.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Thu Mar 05 17:25:13 2009 +0000 2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Thu Mar 05 17:25:37 2009 +0000 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. 2.6 + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -27,6 +27,8 @@ 2.11 2.12 import java.util.*; 2.13 2.14 +import com.sun.tools.javac.api.Messages; 2.15 + 2.16 import com.sun.tools.javac.util.*; 2.17 import com.sun.tools.javac.util.List; 2.18 2.19 @@ -2019,7 +2021,7 @@ 2.20 return t; 2.21 else 2.22 return visit(t); 2.23 - } 2.24 + } 2.25 2.26 List<Type> subst(List<Type> ts) { 2.27 if (from.tail == null) 2.28 @@ -2279,225 +2281,21 @@ 2.29 } 2.30 // </editor-fold> 2.31 2.32 - // <editor-fold defaultstate="collapsed" desc="printType"> 2.33 /** 2.34 - * Visitor for generating a string representation of a given type 2.35 + * Helper method for generating a string representation of a given type 2.36 * accordingly to a given locale 2.37 */ 2.38 public String toString(Type t, Locale locale) { 2.39 - return typePrinter.visit(t, locale); 2.40 + return Printer.createStandardPrinter(messages).visit(t, locale); 2.41 } 2.42 - // where 2.43 - private TypePrinter typePrinter = new TypePrinter(); 2.44 2.45 - public class TypePrinter extends DefaultTypeVisitor<String, Locale> { 2.46 - 2.47 - public String visit(List<Type> ts, Locale locale) { 2.48 - ListBuffer<String> sbuf = lb(); 2.49 - for (Type t : ts) { 2.50 - sbuf.append(visit(t, locale)); 2.51 - } 2.52 - return sbuf.toList().toString(); 2.53 - } 2.54 - 2.55 - @Override 2.56 - public String visitCapturedType(CapturedType t, Locale locale) { 2.57 - return messages.getLocalizedString("compiler.misc.type.captureof", 2.58 - (t.hashCode() & 0xFFFFFFFFL) % Type.CapturedType.PRIME, 2.59 - visit(t.wildcard, locale)); 2.60 - } 2.61 - 2.62 - @Override 2.63 - public String visitForAll(ForAll t, Locale locale) { 2.64 - return "<" + visit(t.tvars, locale) + ">" + visit(t.qtype, locale); 2.65 - } 2.66 - 2.67 - @Override 2.68 - public String visitUndetVar(UndetVar t, Locale locale) { 2.69 - if (t.inst != null) { 2.70 - return visit(t.inst, locale); 2.71 - } else { 2.72 - return visit(t.qtype, locale) + "?"; 2.73 - } 2.74 - } 2.75 - 2.76 - @Override 2.77 - public String visitArrayType(ArrayType t, Locale locale) { 2.78 - return visit(t.elemtype, locale) + "[]"; 2.79 - } 2.80 - 2.81 - @Override 2.82 - public String visitClassType(ClassType t, Locale locale) { 2.83 - StringBuffer buf = new StringBuffer(); 2.84 - if (t.getEnclosingType().tag == CLASS && t.tsym.owner.kind == Kinds.TYP) { 2.85 - buf.append(visit(t.getEnclosingType(), locale)); 2.86 - buf.append("."); 2.87 - buf.append(className(t, false, locale)); 2.88 - } else { 2.89 - buf.append(className(t, true, locale)); 2.90 - } 2.91 - if (t.getTypeArguments().nonEmpty()) { 2.92 - buf.append('<'); 2.93 - buf.append(visit(t.getTypeArguments(), locale)); 2.94 - buf.append(">"); 2.95 - } 2.96 - return buf.toString(); 2.97 - } 2.98 - 2.99 - @Override 2.100 - public String visitMethodType(MethodType t, Locale locale) { 2.101 - return "(" + printMethodArgs(t.argtypes, false, locale) + ")" + visit(t.restype, locale); 2.102 - } 2.103 - 2.104 - @Override 2.105 - public String visitPackageType(PackageType t, Locale locale) { 2.106 - return t.tsym.getQualifiedName().toString(); 2.107 - } 2.108 - 2.109 - @Override 2.110 - public String visitWildcardType(WildcardType t, Locale locale) { 2.111 - StringBuffer s = new StringBuffer(); 2.112 - s.append(t.kind); 2.113 - if (t.kind != UNBOUND) { 2.114 - s.append(visit(t.type, locale)); 2.115 - } 2.116 - return s.toString(); 2.117 - } 2.118 - 2.119 - 2.120 - public String visitType(Type t, Locale locale) { 2.121 - String s = (t.tsym == null || t.tsym.name == null) 2.122 - ? messages.getLocalizedString("compiler.misc.type.none") 2.123 - : t.tsym.name.toString(); 2.124 - return s; 2.125 - } 2.126 - 2.127 - protected String className(ClassType t, boolean longform, Locale locale) { 2.128 - Symbol sym = t.tsym; 2.129 - if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) { 2.130 - StringBuffer s = new StringBuffer(visit(supertype(t), locale)); 2.131 - for (List<Type> is = interfaces(t); is.nonEmpty(); is = is.tail) { 2.132 - s.append("&"); 2.133 - s.append(visit(is.head, locale)); 2.134 - } 2.135 - return s.toString(); 2.136 - } else if (sym.name.length() == 0) { 2.137 - String s; 2.138 - ClassType norm = (ClassType) t.tsym.type; 2.139 - if (norm == null) { 2.140 - s = getLocalizedString(locale, "compiler.misc.anonymous.class", (Object) null); 2.141 - } else if (interfaces(norm).nonEmpty()) { 2.142 - s = getLocalizedString(locale, "compiler.misc.anonymous.class", 2.143 - visit(interfaces(norm).head, locale)); 2.144 - } else { 2.145 - s = getLocalizedString(locale, "compiler.misc.anonymous.class", 2.146 - visit(supertype(norm), locale)); 2.147 - } 2.148 - return s; 2.149 - } else if (longform) { 2.150 - return sym.getQualifiedName().toString(); 2.151 - } else { 2.152 - return sym.name.toString(); 2.153 - } 2.154 - } 2.155 - 2.156 - protected String printMethodArgs(List<Type> args, boolean varArgs, Locale locale) { 2.157 - if (!varArgs) { 2.158 - return visit(args, locale); 2.159 - } else { 2.160 - StringBuffer buf = new StringBuffer(); 2.161 - while (args.tail.nonEmpty()) { 2.162 - buf.append(visit(args.head, locale)); 2.163 - args = args.tail; 2.164 - buf.append(','); 2.165 - } 2.166 - if (args.head.tag == ARRAY) { 2.167 - buf.append(visit(((ArrayType) args.head).elemtype, locale)); 2.168 - buf.append("..."); 2.169 - } else { 2.170 - buf.append(visit(args.head, locale)); 2.171 - } 2.172 - return buf.toString(); 2.173 - } 2.174 - } 2.175 - 2.176 - protected String getLocalizedString(Locale locale, String key, Object... args) { 2.177 - return messages.getLocalizedString(key, args); 2.178 - } 2.179 - }; 2.180 - // </editor-fold> 2.181 - 2.182 - // <editor-fold defaultstate="collapsed" desc="printSymbol"> 2.183 /** 2.184 - * Visitor for generating a string representation of a given symbol 2.185 + * Helper method for generating a string representation of a given type 2.186 * accordingly to a given locale 2.187 */ 2.188 public String toString(Symbol t, Locale locale) { 2.189 - return symbolPrinter.visit(t, locale); 2.190 + return Printer.createStandardPrinter(messages).visit(t, locale); 2.191 } 2.192 - // where 2.193 - private SymbolPrinter symbolPrinter = new SymbolPrinter(); 2.194 - 2.195 - public class SymbolPrinter extends DefaultSymbolVisitor<String, Locale> { 2.196 - 2.197 - @Override 2.198 - public String visitClassSymbol(ClassSymbol sym, Locale locale) { 2.199 - return sym.name.isEmpty() 2.200 - ? getLocalizedString(locale, "compiler.misc.anonymous.class", sym.flatname) 2.201 - : sym.fullname.toString(); 2.202 - } 2.203 - 2.204 - @Override 2.205 - public String visitMethodSymbol(MethodSymbol s, Locale locale) { 2.206 - if ((s.flags() & BLOCK) != 0) { 2.207 - return s.owner.name.toString(); 2.208 - } else { 2.209 - String ms = (s.name == names.init) 2.210 - ? s.owner.name.toString() 2.211 - : s.name.toString(); 2.212 - if (s.type != null) { 2.213 - if (s.type.tag == FORALL) { 2.214 - ms = "<" + typePrinter.visit(s.type.getTypeArguments(), locale) + ">" + ms; 2.215 - } 2.216 - ms += "(" + typePrinter.printMethodArgs( 2.217 - s.type.getParameterTypes(), 2.218 - (s.flags() & VARARGS) != 0, 2.219 - locale) + ")"; 2.220 - } 2.221 - return ms; 2.222 - } 2.223 - } 2.224 - 2.225 - @Override 2.226 - public String visitOperatorSymbol(OperatorSymbol s, Locale locale) { 2.227 - return visitMethodSymbol(s, locale); 2.228 - } 2.229 - 2.230 - @Override 2.231 - public String visitPackageSymbol(PackageSymbol s, Locale locale) { 2.232 - return s.name.isEmpty() 2.233 - ? getLocalizedString(locale, "compiler.misc.unnamed.package") 2.234 - : s.fullname.toString(); 2.235 - } 2.236 - 2.237 - @Override 2.238 - public String visitSymbol(Symbol s, Locale locale) { 2.239 - return s.name.toString(); 2.240 - } 2.241 - 2.242 - public String visit(List<Symbol> ts, Locale locale) { 2.243 - ListBuffer<String> sbuf = lb(); 2.244 - for (Symbol t : ts) { 2.245 - sbuf.append(visit(t, locale)); 2.246 - } 2.247 - return sbuf.toList().toString(); 2.248 - } 2.249 - 2.250 - protected String getLocalizedString(Locale locale, String key, Object... args) { 2.251 - return messages.getLocalizedString(key, args); 2.252 - } 2.253 - }; 2.254 - // </editor-fold> 2.255 2.256 // <editor-fold defaultstate="collapsed" desc="toString"> 2.257 /** 2.258 @@ -3128,7 +2926,7 @@ 2.259 return t; 2.260 } 2.261 // where 2.262 - private List<Type> freshTypeVariables(List<Type> types) { 2.263 + public List<Type> freshTypeVariables(List<Type> types) { 2.264 ListBuffer<Type> result = lb(); 2.265 for (Type t : types) { 2.266 if (t.tag == WILDCARD) {
3.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Mar 05 17:25:13 2009 +0000 3.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Mar 05 17:25:37 2009 +0000 3.3 @@ -836,6 +836,9 @@ 3.4 compiler.misc.type.captureof=\ 3.5 capture#{0} of {1} 3.6 3.7 +compiler.misc.type.captureof.1=\ 3.8 + capture#{0} 3.9 + 3.10 compiler.misc.type.none=\ 3.11 <none> 3.12
4.1 --- a/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java Thu Mar 05 17:25:13 2009 +0000 4.2 +++ b/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java Thu Mar 05 17:25:37 2009 +0000 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. 4.6 + * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -38,6 +38,10 @@ 4.11 import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.MultilineLimit; 4.12 import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind; 4.13 import com.sun.tools.javac.api.Formattable; 4.14 +import com.sun.tools.javac.code.Printer; 4.15 +import com.sun.tools.javac.code.Symbol; 4.16 +import com.sun.tools.javac.code.Type; 4.17 +import com.sun.tools.javac.code.Type.CapturedType; 4.18 import com.sun.tools.javac.file.JavacFileManager; 4.19 4.20 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*; 4.21 @@ -60,16 +64,31 @@ 4.22 * JavacMessages object used by this formatter for i18n. 4.23 */ 4.24 protected JavacMessages messages; 4.25 + 4.26 + /** 4.27 + * Configuration object used by this formatter 4.28 + */ 4.29 private SimpleConfiguration config; 4.30 + 4.31 + /** 4.32 + * Current depth level of the disgnostic being formatted 4.33 + * (!= 0 for subdiagnostics) 4.34 + */ 4.35 protected int depth = 0; 4.36 4.37 /** 4.38 + * Printer instance to be used for formatting types/symbol 4.39 + */ 4.40 + protected Printer printer; 4.41 + 4.42 + /** 4.43 * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object. 4.44 * @param messages 4.45 */ 4.46 protected AbstractDiagnosticFormatter(JavacMessages messages, SimpleConfiguration config) { 4.47 this.messages = messages; 4.48 this.config = config; 4.49 + this.printer = new FormatterPrinter(); 4.50 } 4.51 4.52 public String formatKind(JCDiagnostic d, Locale l) { 4.53 @@ -83,6 +102,14 @@ 4.54 } 4.55 } 4.56 4.57 + @Override 4.58 + public String format(JCDiagnostic d, Locale locale) { 4.59 + printer = new FormatterPrinter(); 4.60 + return formatDiagnostic(d, locale); 4.61 + } 4.62 + 4.63 + abstract String formatDiagnostic(JCDiagnostic d, Locale locale); 4.64 + 4.65 public String formatPosition(JCDiagnostic d, PositionKind pk,Locale l) { 4.66 assert (d.getPosition() != Position.NOPOS); 4.67 return String.valueOf(getPosition(d, pk)); 4.68 @@ -143,12 +170,21 @@ 4.69 else if (arg instanceof Iterable<?>) { 4.70 return formatIterable(d, (Iterable<?>)arg, l); 4.71 } 4.72 - else if (arg instanceof JavaFileObject) 4.73 + else if (arg instanceof Type) { 4.74 + return printer.visit((Type)arg, l); 4.75 + } 4.76 + else if (arg instanceof Symbol) { 4.77 + return printer.visit((Symbol)arg, l); 4.78 + } 4.79 + else if (arg instanceof JavaFileObject) { 4.80 return JavacFileManager.getJavacBaseFileName((JavaFileObject)arg); 4.81 - else if (arg instanceof Formattable) 4.82 + } 4.83 + else if (arg instanceof Formattable) { 4.84 return ((Formattable)arg).toString(l, messages); 4.85 - else 4.86 + } 4.87 + else { 4.88 return String.valueOf(arg); 4.89 + } 4.90 } 4.91 4.92 /** 4.93 @@ -404,4 +440,43 @@ 4.94 return caretEnabled; 4.95 } 4.96 } 4.97 + 4.98 + /** 4.99 + * An enhanced printer for formatting types/symbols used by 4.100 + * AbstractDiagnosticFormatter. Provides alternate numbering of captured 4.101 + * types (they are numbered starting from 1 on each new diagnostic, instead 4.102 + * of relying on the underlying hashcode() method which generates unstable 4.103 + * output). Also detects cycles in wildcard messages (e.g. if the wildcard 4.104 + * type referred by a given captured type C contains C itself) which might 4.105 + * lead to infinite loops. 4.106 + */ 4.107 + protected class FormatterPrinter extends Printer { 4.108 + 4.109 + List<Type> allCaptured = List.nil(); 4.110 + List<Type> seenCaptured = List.nil(); 4.111 + 4.112 + @Override 4.113 + protected String localize(Locale locale, String key, Object... args) { 4.114 + return AbstractDiagnosticFormatter.this.localize(locale, key, args); 4.115 + } 4.116 + 4.117 + @Override 4.118 + public String visitCapturedType(CapturedType t, Locale locale) { 4.119 + if (seenCaptured.contains(t)) 4.120 + return localize(locale, "compiler.misc.type.captureof.1", 4.121 + allCaptured.indexOf(t) + 1); 4.122 + else { 4.123 + try { 4.124 + seenCaptured = seenCaptured.prepend(t); 4.125 + allCaptured = allCaptured.append(t); 4.126 + return localize(locale, "compiler.misc.type.captureof", 4.127 + allCaptured.indexOf(t) + 1, 4.128 + visit(t.wildcard, locale)); 4.129 + } 4.130 + finally { 4.131 + seenCaptured = seenCaptured.tail; 4.132 + } 4.133 + } 4.134 + } 4.135 + } 4.136 }
5.1 --- a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Thu Mar 05 17:25:13 2009 +0000 5.2 +++ b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Thu Mar 05 17:25:37 2009 +0000 5.3 @@ -82,7 +82,7 @@ 5.4 super(msgs, new BasicConfiguration()); 5.5 } 5.6 5.7 - public String format(JCDiagnostic d, Locale l) { 5.8 + public String formatDiagnostic(JCDiagnostic d, Locale l) { 5.9 if (l == null) 5.10 l = messages.getCurrentLocale(); 5.11 String format = selectFormat(d);
6.1 --- a/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Thu Mar 05 17:25:13 2009 +0000 6.2 +++ b/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Thu Mar 05 17:25:37 2009 +0000 6.3 @@ -54,7 +54,7 @@ 6.4 } 6.5 6.6 //provide common default formats 6.7 - public String format(JCDiagnostic d, Locale l) { 6.8 + public String formatDiagnostic(JCDiagnostic d, Locale l) { 6.9 try { 6.10 StringBuffer buf = new StringBuffer(); 6.11 if (d.getPosition() != Position.NOPOS) { 6.12 @@ -82,17 +82,11 @@ 6.13 public String formatMessage(JCDiagnostic d, Locale l) { 6.14 StringBuilder buf = new StringBuilder(); 6.15 Collection<String> args = formatArguments(d, l); 6.16 - buf.append(d.getCode()); 6.17 - String sep = ": "; 6.18 - for (Object o : args) { 6.19 - buf.append(sep); 6.20 - buf.append(o); 6.21 - sep = ", "; 6.22 - } 6.23 + buf.append(localize(null, d.getCode(), args.toArray())); 6.24 if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { 6.25 List<String> subDiags = formatSubdiagnostics(d, null); 6.26 if (subDiags.nonEmpty()) { 6.27 - sep = ""; 6.28 + String sep = ""; 6.29 buf.append(",{"); 6.30 for (String sub : formatSubdiagnostics(d, null)) { 6.31 buf.append(sep); 6.32 @@ -117,4 +111,17 @@ 6.33 else 6.34 return s; 6.35 } 6.36 + 6.37 + @Override 6.38 + protected String localize(Locale l, String key, Object... args) { 6.39 + StringBuilder buf = new StringBuilder(); 6.40 + buf.append(key); 6.41 + String sep = ": "; 6.42 + for (Object o : args) { 6.43 + buf.append(sep); 6.44 + buf.append(o); 6.45 + sep = ", "; 6.46 + } 6.47 + return buf.toString(); 6.48 + } 6.49 }
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/tools/javac/Diagnostics/6799605/T6799605.java Thu Mar 05 17:25:37 2009 +0000 7.3 @@ -0,0 +1,43 @@ 7.4 +/* 7.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 7.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 7.24 + * have any questions. 7.25 + */ 7.26 + 7.27 +/** 7.28 + * @test 7.29 + * @bug 6799605 7.30 + * @summary Basic/Raw formatters should use type/symbol printer instead of toString() 7.31 + * @author mcimadamore 7.32 + * @compile/fail/ref=T6799605.out -XDrawDiagnostics T6799605.java 7.33 + */ 7.34 + 7.35 +class T6799605<X> { 7.36 + 7.37 + <T extends T6799605<T>> void m(T6799605<T> x1) {} 7.38 + <T> void m(T6799605<T> x1, T6799605<T> x2) {} 7.39 + <T> void m(T6799605<T> x1, T6799605<T> x2, T6799605<T> x3) {} 7.40 + 7.41 + void test(T6799605<?> t) { 7.42 + m(t); 7.43 + m(t, t); 7.44 + m(t, t, t); 7.45 + } 7.46 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/tools/javac/Diagnostics/6799605/T6799605.out Thu Mar 05 17:25:37 2009 +0000 8.3 @@ -0,0 +1,4 @@ 8.4 +T6799605.java:39:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605<compiler.misc.type.captureof: 1, ?>, kindname.class, T6799605<X> 8.5 +T6799605.java:40:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>, kindname.class, T6799605<X> 8.6 +T6799605.java:41:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>, kindname.class, T6799605<X> 8.7 +3 errors
9.1 --- a/test/tools/javac/NestedInnerClassNames.out Thu Mar 05 17:25:13 2009 +0000 9.2 +++ b/test/tools/javac/NestedInnerClassNames.out Thu Mar 05 17:25:37 2009 +0000 9.3 @@ -1,15 +1,15 @@ 9.4 -NestedInnerClassNames.java:16:5: compiler.err.already.defined: NestedInnerClassNames, unnamed package 9.5 +NestedInnerClassNames.java:16:5: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package 9.6 NestedInnerClassNames.java:23:9: compiler.err.already.defined: NestedInnerClassNames.foo, NestedInnerClassNames 9.7 -NestedInnerClassNames.java:34:9: compiler.err.already.defined: NestedInnerClassNames, unnamed package 9.8 +NestedInnerClassNames.java:34:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package 9.9 NestedInnerClassNames.java:45:9: compiler.err.already.defined: NestedInnerClassNames.baz, NestedInnerClassNames 9.10 NestedInnerClassNames.java:46:13: compiler.err.already.defined: NestedInnerClassNames.baz.baz, NestedInnerClassNames.baz 9.11 NestedInnerClassNames.java:59:9: compiler.err.already.defined: NestedInnerClassNames.foo$bar, NestedInnerClassNames 9.12 NestedInnerClassNames.java:76:13: compiler.err.already.defined: NestedInnerClassNames.$bar, NestedInnerClassNames 9.13 NestedInnerClassNames.java:90:13: compiler.err.already.defined: NestedInnerClassNames.bar$bar.bar, NestedInnerClassNames.bar$bar 9.14 NestedInnerClassNames.java:109:5: compiler.err.duplicate.class: NestedInnerClassNames.foo.foo 9.15 -NestedInnerClassNames.java:19:9: compiler.err.already.defined: NestedInnerClassNames, unnamed package 9.16 +NestedInnerClassNames.java:19:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package 9.17 NestedInnerClassNames.java:28:13: compiler.err.already.defined: foo, m2() 9.18 -NestedInnerClassNames.java:40:13: compiler.err.already.defined: NestedInnerClassNames, unnamed package 9.19 +NestedInnerClassNames.java:40:13: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package 9.20 NestedInnerClassNames.java:52:13: compiler.err.already.defined: baz, m4() 9.21 NestedInnerClassNames.java:53:17: compiler.err.already.defined: baz.baz, baz 9.22 NestedInnerClassNames.java:67:13: compiler.err.already.defined: foo$bar, m5()
10.1 --- a/test/tools/javac/T6241723.out Thu Mar 05 17:25:13 2009 +0000 10.2 +++ b/test/tools/javac/T6241723.out Thu Mar 05 17:25:37 2009 +0000 10.3 @@ -1,6 +1,6 @@ 10.4 -T6241723.java:21:5: compiler.warn.has.been.deprecated: A1, unnamed package 10.5 +T6241723.java:21:5: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 10.6 T6241723.java:23:7: compiler.warn.has.been.deprecated: A2.A21, A2 10.7 -T6241723.java:26:5: compiler.warn.has.been.deprecated: Z1, unnamed package 10.8 +T6241723.java:26:5: compiler.warn.has.been.deprecated: Z1, compiler.misc.unnamed.package 10.9 T6241723.java:28:7: compiler.warn.has.been.deprecated: Z2.Z21, Z2 10.10 - compiler.err.warnings.and.werror 10.11 1 error
11.1 --- a/test/tools/javac/depDocComment/SuppressDeprecation.out Thu Mar 05 17:25:13 2009 +0000 11.2 +++ b/test/tools/javac/depDocComment/SuppressDeprecation.out Thu Mar 05 17:25:37 2009 +0000 11.3 @@ -1,4 +1,4 @@ 11.4 -SuppressDeprecation.java:130:17: compiler.warn.has.been.deprecated: X, unnamed package 11.5 +SuppressDeprecation.java:130:17: compiler.warn.has.been.deprecated: X, compiler.misc.unnamed.package 11.6 SuppressDeprecation.java:82:10: compiler.warn.has.been.deprecated: g(), T 11.7 SuppressDeprecation.java:83:14: compiler.warn.has.been.deprecated: g(), T 11.8 SuppressDeprecation.java:84:9: compiler.warn.has.been.deprecated: var, T
12.1 --- a/test/tools/javac/mandatoryWarnings/deprecated/Test3.out Thu Mar 05 17:25:13 2009 +0000 12.2 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test3.out Thu Mar 05 17:25:37 2009 +0000 12.3 @@ -1,3 +1,3 @@ 12.4 -A.java:10:9: compiler.warn.has.been.deprecated: A1, unnamed package 12.5 -A.java:10:21: compiler.warn.has.been.deprecated: A1, unnamed package 12.6 +A.java:10:9: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 12.7 +A.java:10:21: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 12.8 2 warnings
13.1 --- a/test/tools/javac/mandatoryWarnings/deprecated/Test3b.out Thu Mar 05 17:25:13 2009 +0000 13.2 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test3b.out Thu Mar 05 17:25:37 2009 +0000 13.3 @@ -1,3 +1,3 @@ 13.4 -A.java:10:9: compiler.warn.has.been.deprecated: A1, unnamed package 13.5 +A.java:10:9: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 13.6 - compiler.note.deprecated.filename.additional: A.java 13.7 1 warning
14.1 --- a/test/tools/javac/mandatoryWarnings/deprecated/Test4.out Thu Mar 05 17:25:13 2009 +0000 14.2 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test4.out Thu Mar 05 17:25:37 2009 +0000 14.3 @@ -1,7 +1,7 @@ 14.4 -A.java:10:9: compiler.warn.has.been.deprecated: A1, unnamed package 14.5 -A.java:10:21: compiler.warn.has.been.deprecated: A1, unnamed package 14.6 -B.java:11:9: compiler.warn.has.been.deprecated: B1, unnamed package 14.7 -B.java:11:21: compiler.warn.has.been.deprecated: B1, unnamed package 14.8 -B.java:12:9: compiler.warn.has.been.deprecated: B1, unnamed package 14.9 -B.java:12:22: compiler.warn.has.been.deprecated: B1, unnamed package 14.10 +A.java:10:9: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 14.11 +A.java:10:21: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 14.12 +B.java:11:9: compiler.warn.has.been.deprecated: B1, compiler.misc.unnamed.package 14.13 +B.java:11:21: compiler.warn.has.been.deprecated: B1, compiler.misc.unnamed.package 14.14 +B.java:12:9: compiler.warn.has.been.deprecated: B1, compiler.misc.unnamed.package 14.15 +B.java:12:22: compiler.warn.has.been.deprecated: B1, compiler.misc.unnamed.package 14.16 6 warnings
15.1 --- a/test/tools/javac/mandatoryWarnings/deprecated/Test4b.out Thu Mar 05 17:25:13 2009 +0000 15.2 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test4b.out Thu Mar 05 17:25:37 2009 +0000 15.3 @@ -1,3 +1,3 @@ 15.4 -A.java:10:9: compiler.warn.has.been.deprecated: A1, unnamed package 15.5 +A.java:10:9: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 15.6 - compiler.note.deprecated.plural.additional 15.7 1 warning
16.1 --- a/test/tools/javac/mandatoryWarnings/deprecated/Test4c.out Thu Mar 05 17:25:13 2009 +0000 16.2 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test4c.out Thu Mar 05 17:25:37 2009 +0000 16.3 @@ -1,4 +1,4 @@ 16.4 -A.java:10:9: compiler.warn.has.been.deprecated: A1, unnamed package 16.5 -A.java:10:21: compiler.warn.has.been.deprecated: A1, unnamed package 16.6 +A.java:10:9: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 16.7 +A.java:10:21: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 16.8 - compiler.note.deprecated.filename: B.java 16.9 2 warnings
17.1 --- a/test/tools/javac/mandatoryWarnings/deprecated/Test4d.out Thu Mar 05 17:25:13 2009 +0000 17.2 +++ b/test/tools/javac/mandatoryWarnings/deprecated/Test4d.out Thu Mar 05 17:25:37 2009 +0000 17.3 @@ -1,5 +1,5 @@ 17.4 -A.java:10:9: compiler.warn.has.been.deprecated: A1, unnamed package 17.5 -A.java:10:21: compiler.warn.has.been.deprecated: A1, unnamed package 17.6 -B.java:11:9: compiler.warn.has.been.deprecated: B1, unnamed package 17.7 +A.java:10:9: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 17.8 +A.java:10:21: compiler.warn.has.been.deprecated: A1, compiler.misc.unnamed.package 17.9 +B.java:11:9: compiler.warn.has.been.deprecated: B1, compiler.misc.unnamed.package 17.10 - compiler.note.deprecated.filename.additional: B.java 17.11 3 warnings
18.1 --- a/test/tools/javac/positions/T6253161.out Thu Mar 05 17:25:13 2009 +0000 18.2 +++ b/test/tools/javac/positions/T6253161.out Thu Mar 05 17:25:37 2009 +0000 18.3 @@ -1,2 +1,2 @@ 18.4 -T6253161.java:19:62: compiler.warn.missing.SVUID: <anonymous T6253161$1$1> 18.5 +T6253161.java:19:62: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6253161$1$1 18.6 1 warning
19.1 --- a/test/tools/javac/positions/T6253161a.out Thu Mar 05 17:25:13 2009 +0000 19.2 +++ b/test/tools/javac/positions/T6253161a.out Thu Mar 05 17:25:37 2009 +0000 19.3 @@ -1,2 +1,2 @@ 19.4 -T6253161a.java:19:62: compiler.warn.missing.SVUID: <anonymous T6253161a$1$1> 19.5 +T6253161a.java:19:62: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6253161a$1$1 19.6 1 warning
20.1 --- a/test/tools/javac/warnings/Deprecation.lintAll.out Thu Mar 05 17:25:13 2009 +0000 20.2 +++ b/test/tools/javac/warnings/Deprecation.lintAll.out Thu Mar 05 17:25:37 2009 +0000 20.3 @@ -1,3 +1,3 @@ 20.4 -Deprecation.java:18:24: compiler.warn.has.been.deprecated: Deprecation, unnamed package 20.5 -Deprecation.java:55:24: compiler.warn.has.been.deprecated: Deprecation, unnamed package 20.6 +Deprecation.java:18:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package 20.7 +Deprecation.java:55:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package 20.8 2 warnings
21.1 --- a/test/tools/javac/warnings/Deprecation.lintDeprecation.out Thu Mar 05 17:25:13 2009 +0000 21.2 +++ b/test/tools/javac/warnings/Deprecation.lintDeprecation.out Thu Mar 05 17:25:37 2009 +0000 21.3 @@ -1,3 +1,3 @@ 21.4 -Deprecation.java:18:24: compiler.warn.has.been.deprecated: Deprecation, unnamed package 21.5 -Deprecation.java:55:24: compiler.warn.has.been.deprecated: Deprecation, unnamed package 21.6 +Deprecation.java:18:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package 21.7 +Deprecation.java:55:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package 21.8 2 warnings