Tue, 24 Feb 2009 07:55:30 -0800
Merge
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Feb 19 14:08:22 2009 -0800 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue Feb 24 07:55:30 2009 -0800 1.3 @@ -245,6 +245,29 @@ 1.4 } 1.5 1.6 /** 1.7 + * Check whether there are any tags to be printed. 1.8 + * 1.9 + * @param doc the Doc object to check for tags. 1.10 + * @return true if there are tags to be printed else return false. 1.11 + */ 1.12 + protected boolean hasTagsToPrint(Doc doc) { 1.13 + if (doc instanceof MethodDoc) { 1.14 + ClassDoc[] intfacs = ((MethodDoc)doc).containingClass().interfaces(); 1.15 + MethodDoc overriddenMethod = ((MethodDoc)doc).overriddenMethod(); 1.16 + if ((intfacs.length > 0 && 1.17 + new ImplementedMethods((MethodDoc)doc, this.configuration).build().length > 0) || 1.18 + overriddenMethod != null) { 1.19 + return true; 1.20 + } 1.21 + } 1.22 + TagletOutputImpl output = new TagletOutputImpl(""); 1.23 + TagletWriter.genTagOuput(configuration.tagletManager, doc, 1.24 + configuration.tagletManager.getCustomTags(doc), 1.25 + getTagletWriterInstance(false), output); 1.26 + return (output.toString().trim().isEmpty()); 1.27 + } 1.28 + 1.29 + /** 1.30 * Returns a TagletWriter that knows how to write HTML. 1.31 * 1.32 * @return a TagletWriter that knows how to write HTML.
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Thu Feb 19 14:08:22 2009 -0800 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Tue Feb 24 07:55:30 2009 -0800 2.3 @@ -164,4 +164,20 @@ 2.4 public void writeMemberFooter(FieldDoc member) { 2.5 writer.dlEnd(); 2.6 } 2.7 + 2.8 + /** 2.9 + * Check to see if member details should be printed. If 2.10 + * nocomment option set or if there is no text to be printed 2.11 + * for deprecation info, inline comment, no serial tag or inline tags, 2.12 + * do not print member details. 2.13 + */ 2.14 + public boolean shouldPrintMemberDetails(FieldDoc field) { 2.15 + if (!configuration().nocomment) 2.16 + if((field.inlineTags().length > 0) || 2.17 + (field.tags("serial").length > 0) || (writer.hasTagsToPrint(field))) 2.18 + return true; 2.19 + if (!Util.isDeprecated(field)) 2.20 + return true; 2.21 + return false; 2.22 + } 2.23 }
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java Thu Feb 19 14:08:22 2009 -0800 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java Tue Feb 24 07:55:30 2009 -0800 3.3 @@ -67,4 +67,10 @@ 3.4 return output.toString(); 3.5 } 3.6 3.7 + /** 3.8 + * Check whether the taglet output is empty. 3.9 + */ 3.10 + public boolean isEmpty() { 3.11 + return (toString().trim().isEmpty()); 3.12 + } 3.13 }
4.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java Thu Feb 19 14:08:22 2009 -0800 4.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java Tue Feb 24 07:55:30 2009 -0800 4.3 @@ -152,6 +152,17 @@ 4.4 * @param member the member to write the header for. 4.5 */ 4.6 public void writeMemberFooter(FieldDoc member); 4.7 + 4.8 + /** 4.9 + * Check to see if member details should be printed. If 4.10 + * nocomment option set or if there is no text to be printed 4.11 + * for deprecation info, inline comment, no serial tag or inline tags, 4.12 + * do not print member details. 4.13 + * 4.14 + * @param member the member to check details for. 4.15 + * @return true if details need to be printed 4.16 + */ 4.17 + public boolean shouldPrintMemberDetails(FieldDoc member); 4.18 } 4.19 4.20 /**
5.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Thu Feb 19 14:08:22 2009 -0800 5.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Tue Feb 24 07:55:30 2009 -0800 5.3 @@ -403,16 +403,17 @@ 5.4 if (classDoc.definesSerializableFields()) { 5.5 FieldDoc serialPersistentField = 5.6 Util.asList(classDoc.serializableFields()).get(0); 5.7 - String comment = serialPersistentField.commentText(); 5.8 - if (comment.length() > 0) { 5.9 + // Check to see if there are inline comments, tags or deprecation 5.10 + // information to be printed. 5.11 + if (fieldWriter.shouldPrintMemberDetails(serialPersistentField)) { 5.12 fieldWriter.writeHeader( 5.13 configuration.getText("doclet.Serialized_Form_class")); 5.14 + fieldWriter.writeMemberDeprecatedInfo(serialPersistentField); 5.15 if (!configuration.nocomment) { 5.16 - fieldWriter.writeMemberDeprecatedInfo(serialPersistentField); 5.17 fieldWriter.writeMemberDescription(serialPersistentField); 5.18 fieldWriter.writeMemberTags(serialPersistentField); 5.19 - fieldWriter.writeMemberFooter(serialPersistentField); 5.20 } 5.21 + fieldWriter.writeMemberFooter(serialPersistentField); 5.22 } 5.23 } 5.24 } 5.25 @@ -429,6 +430,16 @@ 5.26 } 5.27 5.28 /** 5.29 + * Build the field deprecation information. 5.30 + */ 5.31 + public void buildFieldDeprecationInfo() { 5.32 + if (!currentClass.definesSerializableFields()) { 5.33 + FieldDoc field = (FieldDoc)currentMember; 5.34 + fieldWriter.writeMemberDeprecatedInfo(field); 5.35 + } 5.36 + } 5.37 + 5.38 + /** 5.39 * Build the field information. 5.40 */ 5.41 public void buildFieldInfo() { 5.42 @@ -459,7 +470,6 @@ 5.43 "doclet.MissingSerialTag", cd.qualifiedName(), 5.44 field.name()); 5.45 } 5.46 - fieldWriter.writeMemberDeprecatedInfo(field); 5.47 fieldWriter.writeMemberDescription(field); 5.48 fieldWriter.writeMemberTags(field); 5.49 }
6.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Thu Feb 19 14:08:22 2009 -0800 6.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Tue Feb 24 07:55:30 2009 -0800 6.3 @@ -1,30 +1,30 @@ 6.4 <?xml version='1.0' encoding='utf-8'?> 6.5 - 6.6 -<!-- 6.7 - Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 6.8 - DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.9 - 6.10 - This code is free software; you can redistribute it and/or modify it 6.11 - under the terms of the GNU General Public License version 2 only, as 6.12 - published by the Free Software Foundation. Sun designates this 6.13 - particular file as subject to the "Classpath" exception as provided 6.14 - by Sun in the LICENSE file that accompanied this code. 6.15 - 6.16 - This code is distributed in the hope that it will be useful, but WITHOUT 6.17 - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.18 - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.19 - version 2 for more details (a copy is included in the LICENSE file that 6.20 - accompanied this code). 6.21 - 6.22 - You should have received a copy of the GNU General Public License version 6.23 - 2 along with this work; if not, write to the Free Software Foundation, 6.24 - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.25 - 6.26 - Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 6.27 - CA 95054 USA or visit www.sun.com if you need additional information or 6.28 - have any questions. 6.29 ---> 6.30 - 6.31 + 6.32 +<!-- 6.33 + Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 6.34 + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.35 + 6.36 + This code is free software; you can redistribute it and/or modify it 6.37 + under the terms of the GNU General Public License version 2 only, as 6.38 + published by the Free Software Foundation. Sun designates this 6.39 + particular file as subject to the "Classpath" exception as provided 6.40 + by Sun in the LICENSE file that accompanied this code. 6.41 + 6.42 + This code is distributed in the hope that it will be useful, but WITHOUT 6.43 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.44 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.45 + version 2 for more details (a copy is included in the LICENSE file that 6.46 + accompanied this code). 6.47 + 6.48 + You should have received a copy of the GNU General Public License version 6.49 + 2 along with this work; if not, write to the Free Software Foundation, 6.50 + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.51 + 6.52 + Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 6.53 + CA 95054 USA or visit www.sun.com if you need additional information or 6.54 + have any questions. 6.55 +--> 6.56 + 6.57 6.58 <Doclet> 6.59 6.60 @@ -183,8 +183,8 @@ 6.61 <MethodHeader/> 6.62 <SerializableMethods> 6.63 <MethodSubHeader/> 6.64 + <DeprecatedMethodInfo/> 6.65 <MethodInfo> 6.66 - <DeprecatedMethodInfo/> 6.67 <MethodDescription/> 6.68 <MethodTags/> 6.69 </MethodInfo> 6.70 @@ -193,6 +193,7 @@ 6.71 <FieldHeader/> 6.72 <SerializableFields> 6.73 <FieldSubHeader/> 6.74 + <FieldDeprecationInfo/> 6.75 <FieldInfo/> 6.76 <FieldFooter/> 6.77 </SerializableFields>
7.1 --- a/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java Thu Feb 19 14:08:22 2009 -0800 7.2 +++ b/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java Tue Feb 24 07:55:30 2009 -0800 7.3 @@ -25,16 +25,18 @@ 7.4 package com.sun.tools.javac.api; 7.5 7.6 import java.util.Locale; 7.7 +import java.util.Set; 7.8 import javax.tools.Diagnostic; 7.9 +import com.sun.tools.javac.api.DiagnosticFormatter.*; 7.10 7.11 /** 7.12 - * Provides simple functionalities for javac diagnostic formatting 7.13 + * Provides simple functionalities for javac diagnostic formatting. 7.14 * @param <D> type of diagnostic handled by this formatter 7.15 */ 7.16 public interface DiagnosticFormatter<D extends Diagnostic<?>> { 7.17 7.18 /** 7.19 - * Whether the source code output for this diagnostic is to be displayed 7.20 + * Whether the source code output for this diagnostic is to be displayed. 7.21 * 7.22 * @param diag diagnostic to be formatted 7.23 * @return true if the source line this diagnostic refers to is to be displayed 7.24 @@ -42,7 +44,7 @@ 7.25 boolean displaySource(D diag); 7.26 7.27 /** 7.28 - * Format the contents of a diagnostics 7.29 + * Format the contents of a diagnostics. 7.30 * 7.31 * @param diag the diagnostic to be formatted 7.32 * @param l locale object to be used for i18n 7.33 @@ -115,4 +117,97 @@ 7.34 */ 7.35 OFFSET 7.36 } 7.37 + 7.38 + /** 7.39 + * Get a list of all the enabled verbosity options. 7.40 + * @return verbosity options 7.41 + */ 7.42 + public Configuration getConfiguration(); 7.43 + //where 7.44 + 7.45 + /** 7.46 + * This interface provides functionalities for tuning the output of a 7.47 + * diagnostic formatter in multiple ways. 7.48 + */ 7.49 + interface Configuration { 7.50 + /** 7.51 + * Configure the set of diagnostic parts that should be displayed 7.52 + * by the formatter. 7.53 + * @param options options to set 7.54 + */ 7.55 + public void setVisible(Set<DiagnosticPart> visibleParts); 7.56 + 7.57 + /** 7.58 + * Retrieve the set of diagnostic parts that should be displayed 7.59 + * by the formatter. 7.60 + * @return verbosity options 7.61 + */ 7.62 + public Set<DiagnosticPart> getVisible(); 7.63 + 7.64 + //where 7.65 + /** 7.66 + * A given diagnostic message can be divided into sub-parts each of which 7.67 + * might/might not be displayed by the formatter, according to the 7.68 + * current configuration settings. 7.69 + */ 7.70 + public enum DiagnosticPart { 7.71 + /** 7.72 + * Short description of the diagnostic - usually one line long. 7.73 + */ 7.74 + SUMMARY, 7.75 + /** 7.76 + * Longer description that provides additional details w.r.t. the ones 7.77 + * in the diagnostic's description. 7.78 + */ 7.79 + DETAILS, 7.80 + /** 7.81 + * Source line the diagnostic refers to (if applicable). 7.82 + */ 7.83 + SOURCE, 7.84 + /** 7.85 + * Subdiagnostics attached to a given multiline diagnostic. 7.86 + */ 7.87 + SUBDIAGNOSTICS, 7.88 + /** 7.89 + * JLS paragraph this diagnostic might refer to (if applicable). 7.90 + */ 7.91 + JLS; 7.92 + } 7.93 + 7.94 + /** 7.95 + * Set a limit for multiline diagnostics. 7.96 + * Note: Setting a limit has no effect if multiline diagnostics are either 7.97 + * fully enabled or disabled. 7.98 + * 7.99 + * @param limit the kind of limit to be set 7.100 + * @param value the limit value 7.101 + */ 7.102 + public void setMultilineLimit(MultilineLimit limit, int value); 7.103 + 7.104 + /** 7.105 + * Get a multiline diagnostic limit. 7.106 + * 7.107 + * @param limit the kind of limit to be retrieved 7.108 + * @return limit value or -1 if no limit is set 7.109 + */ 7.110 + public int getMultilineLimit(MultilineLimit limit); 7.111 + //where 7.112 + /** 7.113 + * A multiline limit control the verbosity of multiline diagnostics 7.114 + * either by setting a maximum depth of nested multidiagnostics, 7.115 + * or by limiting the amount of subdiagnostics attached to a given 7.116 + * diagnostic (or both). 7.117 + */ 7.118 + public enum MultilineLimit { 7.119 + /** 7.120 + * Controls the maximum depth of nested multiline diagnostics. 7.121 + */ 7.122 + DEPTH, 7.123 + /** 7.124 + * Controls the maximum amount of subdiagnostics that are part of a 7.125 + * given multiline diagnostic. 7.126 + */ 7.127 + LENGTH; 7.128 + } 7.129 + } 7.130 }
8.1 --- a/src/share/classes/com/sun/tools/javac/api/Messages.java Thu Feb 19 14:08:22 2009 -0800 8.2 +++ b/src/share/classes/com/sun/tools/javac/api/Messages.java Tue Feb 24 07:55:30 2009 -0800 8.3 @@ -44,7 +44,7 @@ 8.4 void add(String bundleName) throws MissingResourceException; 8.5 8.6 /** 8.7 - * Get a localized formatted string 8.8 + * Get a localized formatted string. 8.9 * @param l locale in which the text is to be localized 8.10 * @param key locale-independent message key 8.11 * @param args misc message arguments
9.1 --- a/src/share/classes/com/sun/tools/javac/main/OptionName.java Thu Feb 19 14:08:22 2009 -0800 9.2 +++ b/src/share/classes/com/sun/tools/javac/main/OptionName.java Tue Feb 24 07:55:30 2009 -0800 9.3 @@ -40,6 +40,7 @@ 9.4 G_CUSTOM("-g:"), 9.5 XLINT("-Xlint"), 9.6 XLINT_CUSTOM("-Xlint:"), 9.7 + DIAGS("-XDdiags="), 9.8 NOWARN("-nowarn"), 9.9 VERBOSE("-verbose"), 9.10 DEPRECATION("-deprecation"),
10.1 --- a/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Thu Feb 19 14:08:22 2009 -0800 10.2 +++ b/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Tue Feb 24 07:55:30 2009 -0800 10.3 @@ -145,6 +145,7 @@ 10.4 TARGET, 10.5 VERSION, 10.6 FULLVERSION, 10.7 + DIAGS, 10.8 HELP, 10.9 A, 10.10 X, 10.11 @@ -372,6 +373,21 @@ 10.12 return super.process(options, option); 10.13 } 10.14 }, 10.15 + new HiddenOption(DIAGS) { 10.16 + @Override 10.17 + public boolean process(Options options, String option) { 10.18 + Option xd = getOptions(helper, EnumSet.of(XD))[0]; 10.19 + option = option.substring(option.indexOf('=') + 1); 10.20 + String diagsOption = option.contains("%") ? 10.21 + "-XDdiagsFormat=" : 10.22 + "-XDdiags="; 10.23 + diagsOption += option; 10.24 + if (xd.matches(diagsOption)) 10.25 + return xd.process(options, diagsOption); 10.26 + else 10.27 + return false; 10.28 + } 10.29 + }, 10.30 new Option(HELP, "opt.help") { 10.31 @Override 10.32 public boolean process(Options options, String option) {
11.1 --- a/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Thu Feb 19 14:08:22 2009 -0800 11.2 +++ b/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Tue Feb 24 07:55:30 2009 -0800 11.3 @@ -125,7 +125,7 @@ 11.4 return this; 11.5 11.6 defaultAction(e, true); 11.7 - printFormalTypeParameters(e); 11.8 + printFormalTypeParameters(e, true); 11.9 11.10 switch(kind) { 11.11 case CONSTRUCTOR: 11.12 @@ -207,7 +207,7 @@ 11.13 writer.print(" "); 11.14 writer.print(e.getSimpleName()); 11.15 11.16 - printFormalTypeParameters(e); 11.17 + printFormalTypeParameters(e, false); 11.18 11.19 // Print superclass information if informative 11.20 if (kind == CLASS) { 11.21 @@ -364,16 +364,9 @@ 11.22 } 11.23 } 11.24 11.25 - private void printFormalTypeParameters(ExecutableElement executable) { 11.26 - printFormalTypeParameters(executable.getTypeParameters(), true); 11.27 - } 11.28 - 11.29 - private void printFormalTypeParameters(TypeElement type) { 11.30 - printFormalTypeParameters(type.getTypeParameters(), false); 11.31 - } 11.32 - 11.33 - private void printFormalTypeParameters(List<? extends TypeParameterElement> typeParams, 11.34 + private void printFormalTypeParameters(Parameterizable e, 11.35 boolean pad) { 11.36 + List<? extends TypeParameterElement> typeParams = e.getTypeParameters(); 11.37 if (typeParams.size() > 0) { 11.38 writer.print("<"); 11.39
12.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Feb 19 14:08:22 2009 -0800 12.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Feb 24 07:55:30 2009 -0800 12.3 @@ -907,16 +907,16 @@ 12.4 12.5 compiler.err.prob.found.req=\ 12.6 {0}\n\ 12.7 -found : {1}\n\ 12.8 -required: {2} 12.9 +required: {2}\n\ 12.10 +found: {1} 12.11 compiler.warn.prob.found.req=\ 12.12 {0}\n\ 12.13 -found : {1}\n\ 12.14 -required: {2} 12.15 +required: {2}\n\ 12.16 +found: {1} 12.17 compiler.err.prob.found.req.1=\ 12.18 {0} {3}\n\ 12.19 -found : {1}\n\ 12.20 -required: {2} 12.21 +required: {2}\n\ 12.22 +found: {1} 12.23 12.24 ## The following are all possible strings for the first argument ({0}) of the 12.25 ## above strings. 12.26 @@ -951,8 +951,8 @@ 12.27 12.28 compiler.err.type.found.req=\ 12.29 unexpected type\n\ 12.30 -found : {0}\n\ 12.31 -required: {1} 12.32 +required: {1}\n\ 12.33 +found: {0} 12.34 12.35 ## The following are all possible strings for the first argument ({0}) of the 12.36 ## above string. 12.37 @@ -1003,7 +1003,7 @@ 12.38 compiler.err.unexpected.type=\ 12.39 unexpected type\n\ 12.40 required: {0}\n\ 12.41 -found : {1} 12.42 +found: {1} 12.43 12.44 ## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.) 12.45 ## The second argument {1} is the non-resolved symbol 12.46 @@ -1026,17 +1026,17 @@ 12.47 ## The sixth argument {5} is the location type 12.48 compiler.err.cant.resolve.location=\ 12.49 cannot find symbol\n\ 12.50 - symbol : {0} {1}\n\ 12.51 + symbol: {0} {1}\n\ 12.52 location: {4} {5} 12.53 12.54 compiler.err.cant.resolve.location.args=\ 12.55 cannot find symbol\n\ 12.56 - symbol : {0} {1}({3})\n\ 12.57 + symbol: {0} {1}({3})\n\ 12.58 location: {4} {5} 12.59 12.60 compiler.err.cant.resolve.location.args.params=\ 12.61 cannot find symbol\n\ 12.62 - symbol : {0} <{2}>{1}({3})\n\ 12.63 + symbol: {0} <{2}>{1}({3})\n\ 12.64 location: {4} {5} 12.65 12.66 ## The following are all possible string for "kindname".
13.1 --- a/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java Thu Feb 19 14:08:22 2009 -0800 13.2 +++ b/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java Tue Feb 24 07:55:30 2009 -0800 13.3 @@ -24,16 +24,23 @@ 13.4 */ 13.5 package com.sun.tools.javac.util; 13.6 13.7 +import java.util.Arrays; 13.8 import java.util.Collection; 13.9 +import java.util.EnumSet; 13.10 +import java.util.HashMap; 13.11 import java.util.Locale; 13.12 +import java.util.Map; 13.13 +import java.util.Set; 13.14 import javax.tools.JavaFileObject; 13.15 13.16 import com.sun.tools.javac.api.DiagnosticFormatter; 13.17 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.DiagnosticPart; 13.18 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.MultilineLimit; 13.19 +import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind; 13.20 import com.sun.tools.javac.api.Formattable; 13.21 -import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind; 13.22 import com.sun.tools.javac.file.JavacFileManager; 13.23 + 13.24 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*; 13.25 -import static com.sun.tools.javac.util.LayoutCharacters.*; 13.26 13.27 /** 13.28 * This abstract class provides a basic implementation of the functionalities that should be provided 13.29 @@ -50,35 +57,19 @@ 13.30 public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter<JCDiagnostic> { 13.31 13.32 /** 13.33 - * JavacMessages object used by this formatter for i18n 13.34 + * JavacMessages object used by this formatter for i18n. 13.35 */ 13.36 protected JavacMessages messages; 13.37 - protected boolean showSource; 13.38 + private SimpleConfiguration config; 13.39 + protected int depth = 0; 13.40 13.41 /** 13.42 - * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object 13.43 + * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object. 13.44 * @param messages 13.45 */ 13.46 - protected AbstractDiagnosticFormatter(JavacMessages messages, Options options, boolean showSource) { 13.47 + protected AbstractDiagnosticFormatter(JavacMessages messages, SimpleConfiguration config) { 13.48 this.messages = messages; 13.49 - this.showSource = options.get("showSource") == null ? showSource : 13.50 - options.get("showSource").equals("true"); 13.51 - } 13.52 - 13.53 - protected AbstractDiagnosticFormatter(JavacMessages messages, boolean showSource) { 13.54 - this.messages = messages; 13.55 - this.showSource = showSource; 13.56 - } 13.57 - 13.58 - public String formatMessage(JCDiagnostic d, Locale l) { 13.59 - //this code should rely on the locale settings but it's not! See RFE 6443132 13.60 - StringBuilder buf = new StringBuilder(); 13.61 - Collection<String> args = formatArguments(d, l); 13.62 - buf.append(localize(l, d.getCode(), args.toArray())); 13.63 - if (d.isMultiline()) { 13.64 - buf.append(formatSubdiagnostics(d, l)); 13.65 - } 13.66 - return buf.toString(); 13.67 + this.config = config; 13.68 } 13.69 13.70 public String formatKind(JCDiagnostic d, Locale l) { 13.71 @@ -96,8 +87,8 @@ 13.72 assert (d.getPosition() != Position.NOPOS); 13.73 return String.valueOf(getPosition(d, pk)); 13.74 } 13.75 - //WHERE 13.76 - public long getPosition(JCDiagnostic d, PositionKind pk) { 13.77 + //where 13.78 + private long getPosition(JCDiagnostic d, PositionKind pk) { 13.79 switch (pk) { 13.80 case START: return d.getIntStartPosition(); 13.81 case END: return d.getIntEndPosition(); 13.82 @@ -138,8 +129,17 @@ 13.83 * @return string representation of the diagnostic argument 13.84 */ 13.85 protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { 13.86 - if (arg instanceof JCDiagnostic) 13.87 - return format((JCDiagnostic)arg, l); 13.88 + if (arg instanceof JCDiagnostic) { 13.89 + String s = null; 13.90 + depth++; 13.91 + try { 13.92 + s = formatMessage((JCDiagnostic)arg, l); 13.93 + } 13.94 + finally { 13.95 + depth--; 13.96 + } 13.97 + return s; 13.98 + } 13.99 else if (arg instanceof Iterable<?>) { 13.100 return formatIterable(d, (Iterable<?>)arg, l); 13.101 } 13.102 @@ -171,45 +171,74 @@ 13.103 } 13.104 13.105 /** 13.106 - * Format all the subdiagnostics attached to a given diagnostic 13.107 + * Format all the subdiagnostics attached to a given diagnostic. 13.108 * 13.109 * @param d diagnostic whose subdiagnostics are to be formatted 13.110 * @param l locale object to be used for i18n 13.111 + * @return list of all string representations of the subdiagnostics 13.112 + */ 13.113 + protected List<String> formatSubdiagnostics(JCDiagnostic d, Locale l) { 13.114 + List<String> subdiagnostics = List.nil(); 13.115 + int maxDepth = config.getMultilineLimit(MultilineLimit.DEPTH); 13.116 + if (maxDepth == -1 || depth < maxDepth) { 13.117 + depth++; 13.118 + try { 13.119 + int maxCount = config.getMultilineLimit(MultilineLimit.LENGTH); 13.120 + int count = 0; 13.121 + for (JCDiagnostic d2 : d.getSubdiagnostics()) { 13.122 + if (maxCount == -1 || count < maxCount) { 13.123 + subdiagnostics = subdiagnostics.append(formatSubdiagnostic(d, d2, l)); 13.124 + count++; 13.125 + } 13.126 + else 13.127 + break; 13.128 + } 13.129 + } 13.130 + finally { 13.131 + depth--; 13.132 + } 13.133 + } 13.134 + return subdiagnostics; 13.135 + } 13.136 + 13.137 + /** 13.138 + * Format a subdiagnostics attached to a given diagnostic. 13.139 + * 13.140 + * @param parent multiline diagnostic whose subdiagnostics is to be formatted 13.141 + * @param sub subdiagnostic to be formatted 13.142 + * @param l locale object to be used for i18n 13.143 * @return string representation of the subdiagnostics 13.144 */ 13.145 - protected String formatSubdiagnostics(JCDiagnostic d, Locale l) { 13.146 - StringBuilder buf = new StringBuilder(); 13.147 - for (JCDiagnostic d2 : d.getSubdiagnostics()) { 13.148 - buf.append('\n'); 13.149 - String subdiagMsg = format(d2, l); 13.150 - buf.append(indent(subdiagMsg, DiagInc)); 13.151 - } 13.152 - return buf.toString(); 13.153 + protected String formatSubdiagnostic(JCDiagnostic parent, JCDiagnostic sub, Locale l) { 13.154 + return formatMessage(sub, l); 13.155 } 13.156 13.157 /** Format the faulty source code line and point to the error. 13.158 * @param d The diagnostic for which the error line should be printed 13.159 */ 13.160 - protected String formatSourceLine(JCDiagnostic d) { 13.161 + protected String formatSourceLine(JCDiagnostic d, int nSpaces) { 13.162 StringBuilder buf = new StringBuilder(); 13.163 DiagnosticSource source = d.getDiagnosticSource(); 13.164 int pos = d.getIntPosition(); 13.165 - if (d.getIntPosition() != Position.NOPOS) { 13.166 - String line = (source == null ? null : source.getLine(pos)); 13.167 - if (line == null) 13.168 - return ""; 13.169 - buf.append(line+"\n"); 13.170 - int col = source.getColumnNumber(pos, false); 13.171 + if (d.getIntPosition() == Position.NOPOS) 13.172 + throw new AssertionError(); 13.173 + String line = (source == null ? null : source.getLine(pos)); 13.174 + if (line == null) 13.175 + return ""; 13.176 + buf.append(indent(line, nSpaces)); 13.177 + int col = source.getColumnNumber(pos, false); 13.178 + if (config.isCaretEnabled()) { 13.179 + buf.append("\n"); 13.180 for (int i = 0; i < col - 1; i++) { 13.181 buf.append((line.charAt(i) == '\t') ? "\t" : " "); 13.182 } 13.183 - buf.append("^"); 13.184 - } 13.185 - return buf.toString(); 13.186 + buf.append(indent("^", nSpaces)); 13.187 + } 13.188 + return buf.toString(); 13.189 } 13.190 13.191 /** 13.192 - * Converts a String into a locale-dependent representation accordingly to a given locale 13.193 + * Converts a String into a locale-dependent representation accordingly to a given locale. 13.194 * 13.195 * @param l locale object to be used for i18n 13.196 * @param key locale-independent key used for looking up in a resource file 13.197 @@ -221,7 +250,9 @@ 13.198 } 13.199 13.200 public boolean displaySource(JCDiagnostic d) { 13.201 - return showSource && d.getType() != FRAGMENT; 13.202 + return config.getVisible().contains(DiagnosticPart.SOURCE) && 13.203 + d.getType() != FRAGMENT && 13.204 + d.getIntPosition() != Position.NOPOS; 13.205 } 13.206 13.207 /** 13.208 @@ -245,7 +276,7 @@ 13.209 13.210 /** 13.211 * Indent a string by prepending a given amount of empty spaces to each line 13.212 - * of the string 13.213 + * of the string. 13.214 * 13.215 * @param s the string to be indented 13.216 * @param nSpaces the amount of spaces that should be prepended to each line 13.217 @@ -263,4 +294,114 @@ 13.218 } 13.219 return buf.toString(); 13.220 } 13.221 + 13.222 + public SimpleConfiguration getConfiguration() { 13.223 + return config; 13.224 + } 13.225 + 13.226 + static public class SimpleConfiguration implements Configuration { 13.227 + 13.228 + protected Map<MultilineLimit, Integer> multilineLimits; 13.229 + protected EnumSet<DiagnosticPart> visibleParts; 13.230 + protected boolean caretEnabled; 13.231 + 13.232 + public SimpleConfiguration(Set<DiagnosticPart> parts) { 13.233 + multilineLimits = new HashMap<MultilineLimit, Integer>(); 13.234 + setVisible(parts); 13.235 + setMultilineLimit(MultilineLimit.DEPTH, -1); 13.236 + setMultilineLimit(MultilineLimit.LENGTH, -1); 13.237 + setCaretEnabled(true); 13.238 + } 13.239 + 13.240 + @SuppressWarnings("fallthrough") 13.241 + public SimpleConfiguration(Options options, Set<DiagnosticPart> parts) { 13.242 + this(parts); 13.243 + String showSource = null; 13.244 + if ((showSource = options.get("showSource")) != null) { 13.245 + if (showSource.equals("true")) 13.246 + visibleParts.add(DiagnosticPart.SOURCE); 13.247 + else if (showSource.equals("false")) 13.248 + visibleParts.remove(DiagnosticPart.SOURCE); 13.249 + } 13.250 + String diagOpts = options.get("diags"); 13.251 + if (diagOpts != null) {//override -XDshowSource 13.252 + Collection<String> args = Arrays.asList(diagOpts.split(",")); 13.253 + if (args.contains("short")) { 13.254 + visibleParts.remove(DiagnosticPart.DETAILS); 13.255 + visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS); 13.256 + } 13.257 + if (args.contains("source")) 13.258 + visibleParts.add(DiagnosticPart.SOURCE); 13.259 + if (args.contains("-source")) 13.260 + visibleParts.remove(DiagnosticPart.SOURCE); 13.261 + } 13.262 + String multiPolicy = null; 13.263 + if ((multiPolicy = options.get("multilinePolicy")) != null) { 13.264 + if (multiPolicy.equals("disabled")) 13.265 + visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS); 13.266 + else if (multiPolicy.startsWith("limit:")) { 13.267 + String limitString = multiPolicy.substring("limit:".length()); 13.268 + String[] limits = limitString.split(":"); 13.269 + try { 13.270 + switch (limits.length) { 13.271 + case 2: { 13.272 + if (!limits[1].equals("*")) 13.273 + setMultilineLimit(MultilineLimit.DEPTH, Integer.parseInt(limits[1])); 13.274 + } 13.275 + case 1: { 13.276 + if (!limits[0].equals("*")) 13.277 + setMultilineLimit(MultilineLimit.LENGTH, Integer.parseInt(limits[0])); 13.278 + } 13.279 + } 13.280 + } 13.281 + catch(NumberFormatException ex) { 13.282 + setMultilineLimit(MultilineLimit.DEPTH, -1); 13.283 + setMultilineLimit(MultilineLimit.LENGTH, -1); 13.284 + } 13.285 + } 13.286 + } 13.287 + String showCaret = null; 13.288 + if (((showCaret = options.get("showCaret")) != null) && 13.289 + showCaret.equals("false")) 13.290 + setCaretEnabled(false); 13.291 + else 13.292 + setCaretEnabled(true); 13.293 + } 13.294 + 13.295 + public int getMultilineLimit(MultilineLimit limit) { 13.296 + return multilineLimits.get(limit); 13.297 + } 13.298 + 13.299 + public EnumSet<DiagnosticPart> getVisible() { 13.300 + return EnumSet.copyOf(visibleParts); 13.301 + } 13.302 + 13.303 + public void setMultilineLimit(MultilineLimit limit, int value) { 13.304 + multilineLimits.put(limit, value < -1 ? -1 : value); 13.305 + } 13.306 + 13.307 + 13.308 + public void setVisible(Set<DiagnosticPart> diagParts) { 13.309 + visibleParts = EnumSet.copyOf(diagParts); 13.310 + } 13.311 + 13.312 + /** 13.313 + * Shows a '^' sign under the source line displayed by the formatter 13.314 + * (if applicable). 13.315 + * 13.316 + * @param caretEnabled if true enables caret 13.317 + */ 13.318 + public void setCaretEnabled(boolean caretEnabled) { 13.319 + this.caretEnabled = caretEnabled; 13.320 + } 13.321 + 13.322 + /** 13.323 + * Tells whether the caret display is active or not. 13.324 + * 13.325 + * @param caretEnabled if true the caret is enabled 13.326 + */ 13.327 + public boolean isCaretEnabled() { 13.328 + return caretEnabled; 13.329 + } 13.330 + } 13.331 }
14.1 --- a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Thu Feb 19 14:08:22 2009 -0800 14.2 +++ b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Tue Feb 24 07:55:30 2009 -0800 14.3 @@ -25,13 +25,20 @@ 14.4 14.5 package com.sun.tools.javac.util; 14.6 14.7 +import java.util.Collection; 14.8 +import java.util.EnumSet; 14.9 import java.util.HashMap; 14.10 import java.util.Locale; 14.11 import java.util.Map; 14.12 +import java.util.regex.Matcher; 14.13 import javax.tools.JavaFileObject; 14.14 14.15 -import static com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicFormatKind.*; 14.16 +import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration; 14.17 +import com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration; 14.18 + 14.19 import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*; 14.20 +import static com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration.*; 14.21 +import static com.sun.tools.javac.util.LayoutCharacters.*; 14.22 14.23 /** 14.24 * A basic formatter for diagnostic messages. 14.25 @@ -53,7 +60,7 @@ 14.26 */ 14.27 public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { 14.28 14.29 - protected Map<BasicFormatKind, String> availableFormats; 14.30 + protected int currentIndentation = 0; 14.31 14.32 /** 14.33 * Create a basic formatter based on the supplied options. 14.34 @@ -62,21 +69,8 @@ 14.35 * @param msgs JavacMessages object used for i18n 14.36 */ 14.37 @SuppressWarnings("fallthrough") 14.38 - BasicDiagnosticFormatter(Options opts, JavacMessages msgs) { 14.39 - super(msgs, opts, true); 14.40 - initAvailableFormats(); 14.41 - String fmt = opts.get("diags"); 14.42 - if (fmt != null) { 14.43 - String[] formats = fmt.split("\\|"); 14.44 - switch (formats.length) { 14.45 - case 3: 14.46 - availableFormats.put(DEFAULT_CLASS_FORMAT, formats[2]); 14.47 - case 2: 14.48 - availableFormats.put(DEFAULT_NO_POS_FORMAT, formats[1]); 14.49 - default: 14.50 - availableFormats.put(DEFAULT_POS_FORMAT, formats[0]); 14.51 - } 14.52 - } 14.53 + public BasicDiagnosticFormatter(Options options, JavacMessages msgs) { 14.54 + super(msgs, new BasicConfiguration(options)); 14.55 } 14.56 14.57 /** 14.58 @@ -85,15 +79,7 @@ 14.59 * @param msgs JavacMessages object used for i18n 14.60 */ 14.61 public BasicDiagnosticFormatter(JavacMessages msgs) { 14.62 - super(msgs, true); 14.63 - initAvailableFormats(); 14.64 - } 14.65 - 14.66 - public void initAvailableFormats() { 14.67 - availableFormats = new HashMap<BasicFormatKind, String>(); 14.68 - availableFormats.put(DEFAULT_POS_FORMAT, "%f:%l:%_%t%m"); 14.69 - availableFormats.put(DEFAULT_NO_POS_FORMAT, "%p%m"); 14.70 - availableFormats.put(DEFAULT_CLASS_FORMAT, "%f:%_%t%m"); 14.71 + super(msgs, new BasicConfiguration()); 14.72 } 14.73 14.74 public String format(JCDiagnostic d, Locale l) { 14.75 @@ -110,10 +96,55 @@ 14.76 } 14.77 buf.append(meta ? formatMeta(c, d, l) : String.valueOf(c)); 14.78 } 14.79 - if (displaySource(d)) { 14.80 - buf.append("\n" + formatSourceLine(d)); 14.81 + if (depth == 0) 14.82 + return addSourceLineIfNeeded(d, buf.toString()); 14.83 + else 14.84 + return buf.toString(); 14.85 + } 14.86 + 14.87 + public String formatMessage(JCDiagnostic d, Locale l) { 14.88 + int prevIndentation = currentIndentation; 14.89 + try { 14.90 + StringBuilder buf = new StringBuilder(); 14.91 + Collection<String> args = formatArguments(d, l); 14.92 + String msg = localize(l, d.getCode(), args.toArray()); 14.93 + String[] lines = msg.split("\n"); 14.94 + if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) { 14.95 + currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY); 14.96 + buf.append(indent(lines[0], currentIndentation)); //summary 14.97 + } 14.98 + if (lines.length > 1 && getConfiguration().getVisible().contains(DiagnosticPart.DETAILS)) { 14.99 + currentIndentation += getConfiguration().getIndentation(DiagnosticPart.DETAILS); 14.100 + for (int i = 1;i < lines.length; i++) { 14.101 + buf.append("\n" + indent(lines[i], currentIndentation)); 14.102 + } 14.103 + } 14.104 + if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { 14.105 + currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS); 14.106 + for (String sub : formatSubdiagnostics(d, l)) { 14.107 + buf.append("\n" + sub); 14.108 + } 14.109 + } 14.110 + return buf.toString(); 14.111 } 14.112 - return buf.toString(); 14.113 + finally { 14.114 + currentIndentation = prevIndentation; 14.115 + } 14.116 + } 14.117 + 14.118 + protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) { 14.119 + if (!displaySource(d)) 14.120 + return msg; 14.121 + else { 14.122 + BasicConfiguration conf = getConfiguration(); 14.123 + int indentSource = conf.getIndentation(DiagnosticPart.SOURCE); 14.124 + String sourceLine = "\n" + formatSourceLine(d, indentSource); 14.125 + boolean singleLine = msg.indexOf("\n") == -1; 14.126 + if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM) 14.127 + return msg + sourceLine; 14.128 + else 14.129 + return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n"); 14.130 + } 14.131 } 14.132 14.133 protected String formatMeta(char c, JCDiagnostic d, Locale l) { 14.134 @@ -164,34 +195,199 @@ 14.135 14.136 private String selectFormat(JCDiagnostic d) { 14.137 DiagnosticSource source = d.getDiagnosticSource(); 14.138 - String format = availableFormats.get(DEFAULT_NO_POS_FORMAT); 14.139 + String format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT); 14.140 if (source != null) { 14.141 if (d.getIntPosition() != Position.NOPOS) { 14.142 - format = availableFormats.get(DEFAULT_POS_FORMAT); 14.143 + format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_POS_FORMAT); 14.144 } else if (source.getFile() != null && 14.145 source.getFile().getKind() == JavaFileObject.Kind.CLASS) { 14.146 - format = availableFormats.get(DEFAULT_CLASS_FORMAT); 14.147 + format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT); 14.148 } 14.149 } 14.150 return format; 14.151 } 14.152 14.153 - /** 14.154 - * This enum contains all the kinds of formatting patterns supported 14.155 - * by a basic diagnostic formatter. 14.156 - */ 14.157 - public enum BasicFormatKind { 14.158 + @Override 14.159 + public BasicConfiguration getConfiguration() { 14.160 + return (BasicConfiguration)super.getConfiguration(); 14.161 + } 14.162 + 14.163 + static public class BasicConfiguration extends SimpleConfiguration { 14.164 + 14.165 + protected Map<DiagnosticPart, Integer> indentationLevels; 14.166 + protected Map<BasicFormatKind, String> availableFormats; 14.167 + protected SourcePosition sourcePosition; 14.168 + 14.169 + @SuppressWarnings("fallthrough") 14.170 + public BasicConfiguration(Options options) { 14.171 + super(options, EnumSet.of(DiagnosticPart.SUMMARY, 14.172 + DiagnosticPart.DETAILS, 14.173 + DiagnosticPart.SUBDIAGNOSTICS, 14.174 + DiagnosticPart.SOURCE)); 14.175 + initFormat(); 14.176 + initIndentation(); 14.177 + String fmt = options.get("diagsFormat"); 14.178 + if (fmt != null) { 14.179 + String[] formats = fmt.split("\\|"); 14.180 + switch (formats.length) { 14.181 + case 3: 14.182 + setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, formats[2]); 14.183 + case 2: 14.184 + setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, formats[1]); 14.185 + default: 14.186 + setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, formats[0]); 14.187 + } 14.188 + } 14.189 + String sourcePosition = null; 14.190 + if ((((sourcePosition = options.get("sourcePosition")) != null)) && 14.191 + sourcePosition.equals("bottom")) 14.192 + setSourcePosition(SourcePosition.BOTTOM); 14.193 + else 14.194 + setSourcePosition(SourcePosition.AFTER_SUMMARY); 14.195 + String indent = options.get("diagsIndentation"); 14.196 + if (indent != null) { 14.197 + String[] levels = indent.split("\\|"); 14.198 + try { 14.199 + switch (levels.length) { 14.200 + case 5: 14.201 + setIndentation(DiagnosticPart.JLS, 14.202 + Integer.parseInt(levels[4])); 14.203 + case 4: 14.204 + setIndentation(DiagnosticPart.SUBDIAGNOSTICS, 14.205 + Integer.parseInt(levels[3])); 14.206 + case 3: 14.207 + setIndentation(DiagnosticPart.SOURCE, 14.208 + Integer.parseInt(levels[2])); 14.209 + case 2: 14.210 + setIndentation(DiagnosticPart.DETAILS, 14.211 + Integer.parseInt(levels[1])); 14.212 + default: 14.213 + setIndentation(DiagnosticPart.SUMMARY, 14.214 + Integer.parseInt(levels[0])); 14.215 + } 14.216 + } 14.217 + catch (NumberFormatException ex) { 14.218 + initIndentation(); 14.219 + } 14.220 + } 14.221 + } 14.222 + 14.223 + public BasicConfiguration() { 14.224 + super(EnumSet.of(DiagnosticPart.SUMMARY, 14.225 + DiagnosticPart.DETAILS, 14.226 + DiagnosticPart.SUBDIAGNOSTICS, 14.227 + DiagnosticPart.SOURCE)); 14.228 + initFormat(); 14.229 + initIndentation(); 14.230 + } 14.231 + //where 14.232 + private void initFormat() { 14.233 + availableFormats = new HashMap<BasicFormatKind, String>(); 14.234 + setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, "%f:%l:%_%t%m"); 14.235 + setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, "%p%m"); 14.236 + setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, "%f:%_%t%m"); 14.237 + } 14.238 + //where 14.239 + private void initIndentation() { 14.240 + indentationLevels = new HashMap<DiagnosticPart, Integer>(); 14.241 + setIndentation(DiagnosticPart.SUMMARY, 0); 14.242 + setIndentation(DiagnosticPart.DETAILS, DetailsInc); 14.243 + setIndentation(DiagnosticPart.SUBDIAGNOSTICS, DiagInc); 14.244 + setIndentation(DiagnosticPart.SOURCE, 0); 14.245 + } 14.246 + 14.247 /** 14.248 - * A format string to be used for diagnostics with a given position. 14.249 - */ 14.250 - DEFAULT_POS_FORMAT, 14.251 + * Get the amount of spaces for a given indentation kind 14.252 + * @param diagPart the diagnostic part for which the indentation is 14.253 + * to be retrieved 14.254 + * @return the amount of spaces used for the specified indentation kind 14.255 + */ 14.256 + public int getIndentation(DiagnosticPart diagPart) { 14.257 + return indentationLevels.get(diagPart); 14.258 + } 14.259 + 14.260 /** 14.261 - * A format string to be used for diagnostics without a given position. 14.262 - */ 14.263 - DEFAULT_NO_POS_FORMAT, 14.264 + * Set the indentation level for various element of a given diagnostic - 14.265 + * this might lead to more readable diagnostics 14.266 + * 14.267 + * @param indentationKind kind of indentation to be set 14.268 + * @param nSpaces amount of spaces for the specified diagnostic part 14.269 + */ 14.270 + public void setIndentation(DiagnosticPart diagPart, int nSpaces) { 14.271 + indentationLevels.put(diagPart, nSpaces); 14.272 + } 14.273 + 14.274 /** 14.275 - * A format string to be used for diagnostics regarding classfiles 14.276 - */ 14.277 - DEFAULT_CLASS_FORMAT; 14.278 + * Set the source line positioning used by this formatter 14.279 + * 14.280 + * @param sourcePos a positioning value for source line 14.281 + */ 14.282 + public void setSourcePosition(SourcePosition sourcePos) { 14.283 + sourcePosition = sourcePos; 14.284 + } 14.285 + 14.286 + /** 14.287 + * Get the source line positioning used by this formatter 14.288 + * 14.289 + * @return the positioning value used by this formatter 14.290 + */ 14.291 + public SourcePosition getSourcePosition() { 14.292 + return sourcePosition; 14.293 + } 14.294 + //where 14.295 + /** 14.296 + * A source positioning value controls the position (within a given 14.297 + * diagnostic message) in which the source line the diagnostic refers to 14.298 + * should be displayed (if applicable) 14.299 + */ 14.300 + public enum SourcePosition { 14.301 + /** 14.302 + * Source line is displayed after the diagnostic message 14.303 + */ 14.304 + BOTTOM, 14.305 + /** 14.306 + * Source line is displayed after the first line of the diagnostic 14.307 + * message 14.308 + */ 14.309 + AFTER_SUMMARY; 14.310 + } 14.311 + 14.312 + /** 14.313 + * Set a metachar string for a specific format 14.314 + * 14.315 + * @param kind the format kind to be set 14.316 + * @param s the metachar string specifying the format 14.317 + */ 14.318 + public void setFormat(BasicFormatKind kind, String s) { 14.319 + availableFormats.put(kind, s); 14.320 + } 14.321 + 14.322 + /** 14.323 + * Get a metachar string for a specific format 14.324 + * 14.325 + * @param sourcePos a positioning value for source line 14.326 + */ 14.327 + public String getFormat(BasicFormatKind kind) { 14.328 + return availableFormats.get(kind); 14.329 + } 14.330 + //where 14.331 + /** 14.332 + * This enum contains all the kinds of formatting patterns supported 14.333 + * by a basic diagnostic formatter. 14.334 + */ 14.335 + public enum BasicFormatKind { 14.336 + /** 14.337 + * A format string to be used for diagnostics with a given position. 14.338 + */ 14.339 + DEFAULT_POS_FORMAT, 14.340 + /** 14.341 + * A format string to be used for diagnostics without a given position. 14.342 + */ 14.343 + DEFAULT_NO_POS_FORMAT, 14.344 + /** 14.345 + * A format string to be used for diagnostics regarding classfiles 14.346 + */ 14.347 + DEFAULT_CLASS_FORMAT; 14.348 + } 14.349 } 14.350 }
15.1 --- a/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java Thu Feb 19 14:08:22 2009 -0800 15.2 +++ b/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java Tue Feb 24 07:55:30 2009 -0800 15.3 @@ -39,9 +39,13 @@ 15.4 */ 15.5 final static int TabInc = 8; 15.6 15.7 - /** Diagnostic standard indentation 15.8 + /** Standard indentation for subdiagnostics 15.9 */ 15.10 - final static int DiagInc = 2; 15.11 + final static int DiagInc = 4; 15.12 + 15.13 + /** Standard indentation for additional diagnostic lines 15.14 + */ 15.15 + final static int DetailsInc = 2; 15.16 15.17 /** Tabulator character. 15.18 */
16.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java Thu Feb 19 14:08:22 2009 -0800 16.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java Tue Feb 24 07:55:30 2009 -0800 16.3 @@ -93,17 +93,17 @@ 16.4 protected DiagnosticListener<? super JavaFileObject> diagListener; 16.5 16.6 /** 16.7 - * Formatter for diagnostics 16.8 + * Formatter for diagnostics. 16.9 */ 16.10 private DiagnosticFormatter<JCDiagnostic> diagFormatter; 16.11 16.12 /** 16.13 - * Keys for expected diagnostics 16.14 + * Keys for expected diagnostics. 16.15 */ 16.16 public Set<String> expectDiagKeys; 16.17 16.18 /** 16.19 - * JavacMessages object used for localization 16.20 + * JavacMessages object used for localization. 16.21 */ 16.22 private JavacMessages messages; 16.23 16.24 @@ -206,6 +206,18 @@ 16.25 return source == null ? null : source.getFile(); 16.26 } 16.27 16.28 + /** Get the current diagnostic formatter. 16.29 + */ 16.30 + public DiagnosticFormatter<JCDiagnostic> getDiagnosticFormatter() { 16.31 + return diagFormatter; 16.32 + } 16.33 + 16.34 + /** Set the current diagnostic formatter. 16.35 + */ 16.36 + public void setDiagnosticFormatter(DiagnosticFormatter<JCDiagnostic> diagFormatter) { 16.37 + this.diagFormatter = diagFormatter; 16.38 + } 16.39 + 16.40 /** Flush the logs 16.41 */ 16.42 public void flush() {
17.1 --- a/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Thu Feb 19 14:08:22 2009 -0800 17.2 +++ b/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Tue Feb 24 07:55:30 2009 -0800 17.3 @@ -24,9 +24,14 @@ 17.4 */ 17.5 package com.sun.tools.javac.util; 17.6 17.7 +import java.util.Collection; 17.8 +import java.util.EnumSet; 17.9 import java.util.Locale; 17.10 17.11 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.*; 17.12 import com.sun.tools.javac.api.Formattable; 17.13 +import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration; 17.14 + 17.15 import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*; 17.16 17.17 /** 17.18 @@ -35,14 +40,17 @@ 17.19 * or not the source name and position are set. This formatter provides a standardized, localize-independent 17.20 * implementation of a diagnostic formatter; as such, this formatter is best suited for testing purposes. 17.21 */ 17.22 -public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter { 17.23 +public final class RawDiagnosticFormatter extends AbstractDiagnosticFormatter { 17.24 17.25 /** 17.26 * Create a formatter based on the supplied options. 17.27 * @param msgs 17.28 */ 17.29 - public RawDiagnosticFormatter(Options opts) { 17.30 - super(null, opts, false); 17.31 + public RawDiagnosticFormatter(Options options) { 17.32 + super(null, new SimpleConfiguration(options, 17.33 + EnumSet.of(DiagnosticPart.SUMMARY, 17.34 + DiagnosticPart.DETAILS, 17.35 + DiagnosticPart.SUBDIAGNOSTICS))); 17.36 } 17.37 17.38 //provide common default formats 17.39 @@ -62,7 +70,7 @@ 17.40 buf.append(' '); 17.41 buf.append(formatMessage(d, null)); 17.42 if (displaySource(d)) 17.43 - buf.append("\n" + formatSourceLine(d)); 17.44 + buf.append("\n" + formatSourceLine(d, 0)); 17.45 return buf.toString(); 17.46 } 17.47 catch (Exception e) { 17.48 @@ -71,6 +79,32 @@ 17.49 } 17.50 } 17.51 17.52 + public String formatMessage(JCDiagnostic d, Locale l) { 17.53 + StringBuilder buf = new StringBuilder(); 17.54 + Collection<String> args = formatArguments(d, l); 17.55 + buf.append(d.getCode()); 17.56 + String sep = ": "; 17.57 + for (Object o : args) { 17.58 + buf.append(sep); 17.59 + buf.append(o); 17.60 + sep = ", "; 17.61 + } 17.62 + if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { 17.63 + List<String> subDiags = formatSubdiagnostics(d, null); 17.64 + if (subDiags.nonEmpty()) { 17.65 + sep = ""; 17.66 + buf.append(",{"); 17.67 + for (String sub : formatSubdiagnostics(d, null)) { 17.68 + buf.append(sep); 17.69 + buf.append("(" + sub + ")"); 17.70 + sep = ","; 17.71 + } 17.72 + buf.append('}'); 17.73 + } 17.74 + } 17.75 + return buf.toString(); 17.76 + } 17.77 + 17.78 @Override 17.79 protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { 17.80 String s; 17.81 @@ -83,31 +117,4 @@ 17.82 else 17.83 return s; 17.84 } 17.85 - 17.86 - @Override 17.87 - protected String formatSubdiagnostics(JCDiagnostic d, Locale l) { 17.88 - StringBuilder buf = new StringBuilder(); 17.89 - String sep = ""; 17.90 - buf.append(",{"); 17.91 - for (JCDiagnostic d2 : d.getSubdiagnostics()) { 17.92 - buf.append(sep); 17.93 - buf.append("(" + format(d2, l) + ")"); 17.94 - sep = ","; 17.95 - } 17.96 - buf.append('}'); 17.97 - return buf.toString(); 17.98 - } 17.99 - 17.100 - @Override 17.101 - protected String localize(Locale l, String s, Object... args) { 17.102 - StringBuffer buf = new StringBuffer(); 17.103 - buf.append(s); 17.104 - String sep = ": "; 17.105 - for (Object o : args) { 17.106 - buf.append(sep); 17.107 - buf.append(o); 17.108 - sep = ", "; 17.109 - } 17.110 - return buf.toString(); 17.111 - } 17.112 }
18.1 --- a/src/share/classes/javax/lang/model/element/ExecutableElement.java Thu Feb 19 14:08:22 2009 -0800 18.2 +++ b/src/share/classes/javax/lang/model/element/ExecutableElement.java Tue Feb 24 07:55:30 2009 -0800 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 18.6 + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -40,7 +40,7 @@ 18.11 * @see ExecutableType 18.12 * @since 1.6 18.13 */ 18.14 -public interface ExecutableElement extends Element { 18.15 +public interface ExecutableElement extends Element, Parameterizable { 18.16 /** 18.17 * Returns the formal type parameters of this executable 18.18 * in declaration order.
19.1 --- a/src/share/classes/javax/lang/model/element/PackageElement.java Thu Feb 19 14:08:22 2009 -0800 19.2 +++ b/src/share/classes/javax/lang/model/element/PackageElement.java Tue Feb 24 07:55:30 2009 -0800 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 19.6 + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. 19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 * 19.9 * This code is free software; you can redistribute it and/or modify it 19.10 @@ -25,7 +25,6 @@ 19.11 19.12 package javax.lang.model.element; 19.13 19.14 - 19.15 /** 19.16 * Represents a package program element. Provides access to information 19.17 * about the package and its members. 19.18 @@ -36,8 +35,7 @@ 19.19 * @see javax.lang.model.util.Elements#getPackageOf 19.20 * @since 1.6 19.21 */ 19.22 - 19.23 -public interface PackageElement extends Element { 19.24 +public interface PackageElement extends Element, QualifiedNameable { 19.25 19.26 /** 19.27 * Returns the fully qualified name of this package.
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/src/share/classes/javax/lang/model/element/Parameterizable.java Tue Feb 24 07:55:30 2009 -0800 20.3 @@ -0,0 +1,45 @@ 20.4 +/* 20.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. Sun designates this 20.11 + * particular file as subject to the "Classpath" exception as provided 20.12 + * by Sun in the LICENSE file that accompanied this code. 20.13 + * 20.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.17 + * version 2 for more details (a copy is included in the LICENSE file that 20.18 + * accompanied this code). 20.19 + * 20.20 + * You should have received a copy of the GNU General Public License version 20.21 + * 2 along with this work; if not, write to the Free Software Foundation, 20.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.23 + * 20.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 20.26 + * have any questions. 20.27 + */ 20.28 + 20.29 +package javax.lang.model.element; 20.30 + 20.31 +import java.util.List; 20.32 + 20.33 +/** 20.34 + * A mixin interface for an element that has type parameters. 20.35 + * 20.36 + * @author Joseph D. Darcy 20.37 + * @since 1.7 20.38 + */ 20.39 +public interface Parameterizable extends Element { 20.40 + /** 20.41 + * Returns the formal type parameters of the type element in 20.42 + * declaration order. 20.43 + * 20.44 + * @return the formal type parameters, or an empty list 20.45 + * if there are none 20.46 + */ 20.47 + List<? extends TypeParameterElement> getTypeParameters(); 20.48 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/src/share/classes/javax/lang/model/element/QualifiedNameable.java Tue Feb 24 07:55:30 2009 -0800 21.3 @@ -0,0 +1,41 @@ 21.4 +/* 21.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 + * 21.8 + * This code is free software; you can redistribute it and/or modify it 21.9 + * under the terms of the GNU General Public License version 2 only, as 21.10 + * published by the Free Software Foundation. Sun designates this 21.11 + * particular file as subject to the "Classpath" exception as provided 21.12 + * by Sun in the LICENSE file that accompanied this code. 21.13 + * 21.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 21.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.17 + * version 2 for more details (a copy is included in the LICENSE file that 21.18 + * accompanied this code). 21.19 + * 21.20 + * You should have received a copy of the GNU General Public License version 21.21 + * 2 along with this work; if not, write to the Free Software Foundation, 21.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.23 + * 21.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 21.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 21.26 + * have any questions. 21.27 + */ 21.28 + 21.29 +package javax.lang.model.element; 21.30 + 21.31 +/** 21.32 + * A mixin interface for an element that has a qualified name. 21.33 + * 21.34 + * @author Joseph D. Darcy 21.35 + * @since 1.7 21.36 + */ 21.37 +public interface QualifiedNameable extends Element { 21.38 + /** 21.39 + * Returns the fully qualified name of an element. 21.40 + * 21.41 + * @return the fully qualified name of an element 21.42 + */ 21.43 + Name getQualifiedName(); 21.44 +}
22.1 --- a/src/share/classes/javax/lang/model/element/TypeElement.java Thu Feb 19 14:08:22 2009 -0800 22.2 +++ b/src/share/classes/javax/lang/model/element/TypeElement.java Tue Feb 24 07:55:30 2009 -0800 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 22.6 + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -59,7 +59,7 @@ 22.11 * @see DeclaredType 22.12 * @since 1.6 22.13 */ 22.14 -public interface TypeElement extends Element { 22.15 +public interface TypeElement extends Element, Parameterizable, QualifiedNameable { 22.16 22.17 /** 22.18 * Returns the <i>nesting kind</i> of this type element.
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Tue Feb 24 07:55:30 2009 -0800 23.3 @@ -0,0 +1,151 @@ 23.4 +/* 23.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. Sun designates this 23.11 + * particular file as subject to the "Classpath" exception as provided 23.12 + * by Sun in the LICENSE file that accompanied this code. 23.13 + * 23.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.17 + * version 2 for more details (a copy is included in the LICENSE file that 23.18 + * accompanied this code). 23.19 + * 23.20 + * You should have received a copy of the GNU General Public License version 23.21 + * 2 along with this work; if not, write to the Free Software Foundation, 23.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.23 + * 23.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 23.26 + * have any questions. 23.27 + */ 23.28 + 23.29 +/* 23.30 + * @test 23.31 + * @bug 6802694 23.32 + * @summary This test verifies deprecation info in serialized-form.html. 23.33 + * @author Bhavesh Patel 23.34 + * @library ../lib/ 23.35 + * @build JavadocTester 23.36 + * @build TestSerializedFormDeprecationInfo 23.37 + * @run main TestSerializedFormDeprecationInfo 23.38 + */ 23.39 + 23.40 +public class TestSerializedFormDeprecationInfo extends JavadocTester { 23.41 + 23.42 + private static final String BUG_ID = "6802694"; 23.43 + 23.44 + // Test for normal run of javadoc. The serialized-form.html should 23.45 + // display the inline comments, tags and deprecation information if any. 23.46 + private static final String[][] TEST_CMNT_DEPR = { 23.47 + {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL + NL + 23.48 + "<DT><STRONG>Throws:</STRONG>" + NL + "<DD><CODE>" + 23.49 + "java.io.IOException</CODE><DT><STRONG>See Also:</STRONG>" + 23.50 + "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" + 23.51 + "<CODE>C1.setUndecorated(boolean)</CODE></A></DD>" + NL + 23.52 + "</DL>" + NL + "</DL>"}, 23.53 + {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + 23.54 + "<DD><STRONG>Deprecated.</STRONG> <I>As of JDK version" + 23.55 + " 1.5, replaced by" + NL + 23.56 + " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" + 23.57 + "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + 23.58 + "<DD>This field indicates whether the C1 is undecorated." + NL + 23.59 + "<P>" + NL + "<DT><DD> <DL>" + NL + 23.60 + "<DT><STRONG>Since:</STRONG></DT>" + NL + 23.61 + " <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" + 23.62 + "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" + 23.63 + "<CODE>C1.setUndecorated(boolean)</CODE></A></DL>" + NL + 23.64 + "</DL>"}, 23.65 + {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + 23.66 + "<DD><STRONG>Deprecated.</STRONG> <I>As of JDK version" + 23.67 + " 1.5, replaced by" + NL + 23.68 + " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" + 23.69 + "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL + 23.70 + "<DD>Reads the object stream." + NL + "<P>" + NL + 23.71 + "<DD><DL>" + NL + NL + "<DT><STRONG>Throws:" + 23.72 + "</STRONG>" + NL + "<DD><CODE><code>" + 23.73 + "IOException</code></CODE>" + NL + 23.74 + "<DD><CODE>java.io.IOException</CODE></DD>" + NL + 23.75 + "</DL>" + NL + "</DL>"}, 23.76 + {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + 23.77 + "<DD><STRONG>Deprecated.</STRONG> <DD>" + 23.78 + "The name for this class." + NL + "<P>" + NL + 23.79 + "<DT><DD> <DL>" + NL + "</DL>" + NL + "</DL>"}}; 23.80 + 23.81 + // Test with -nocomment option. The serialized-form.html should 23.82 + // not display the inline comments and tags but should display deprecation 23.83 + // information if any. 23.84 + private static final String[][] TEST_NOCMNT = { 23.85 + {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "boolean <STRONG>" + 23.86 + "undecorated</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" + 23.87 + "Deprecated.</STRONG> <I>As of JDK version 1.5, replaced by" + NL + 23.88 + " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\"><CODE>" + 23.89 + "setUndecorated(boolean)</CODE></A>.</I></DL>"}, 23.90 + {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" + 23.91 + "Deprecated.</STRONG> <I>As of JDK version" + 23.92 + " 1.5, replaced by" + NL + 23.93 + " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" + 23.94 + "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL + 23.95 + "</DL>"}, 23.96 + {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" + 23.97 + "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" + 23.98 + "Deprecated.</STRONG> </DL>"}}; 23.99 + 23.100 + // Test with -nodeprecated option. The serialized-form.html should 23.101 + // ignore the -nodeprecated tag and display the deprecation info. This 23.102 + // test is similar to the normal run of javadoc in which inline comment, tags 23.103 + // and deprecation information will be displayed. 23.104 + private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR; 23.105 + 23.106 + // Test with -nodeprecated and -nocomment options. The serialized-form.html should 23.107 + // ignore the -nodeprecated tag and display the deprecation info but should not 23.108 + // display the inline comments and tags. This test is similar to the test with 23.109 + // -nocomment option. 23.110 + private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT; 23.111 + 23.112 + private static final String[] ARGS1 = 23.113 + new String[] { 23.114 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"}; 23.115 + 23.116 + private static final String[] ARGS2 = 23.117 + new String[] { 23.118 + "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"}; 23.119 + 23.120 + private static final String[] ARGS3 = 23.121 + new String[] { 23.122 + "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"}; 23.123 + 23.124 + private static final String[] ARGS4 = 23.125 + new String[] { 23.126 + "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"}; 23.127 + 23.128 + /** 23.129 + * The entry point of the test. 23.130 + * @param args the array of command line arguments. 23.131 + */ 23.132 + public static void main(String[] args) { 23.133 + TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo(); 23.134 + run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT); 23.135 + run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR); 23.136 + run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR); 23.137 + run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR); 23.138 + tester.printSummary(); 23.139 + } 23.140 + 23.141 + /** 23.142 + * {@inheritDoc} 23.143 + */ 23.144 + public String getBugId() { 23.145 + return BUG_ID; 23.146 + } 23.147 + 23.148 + /** 23.149 + * {@inheritDoc} 23.150 + */ 23.151 + public String getBugName() { 23.152 + return getClass().getName(); 23.153 + } 23.154 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C1.java Tue Feb 24 07:55:30 2009 -0800 24.3 @@ -0,0 +1,108 @@ 24.4 +/* 24.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 + * 24.8 + * This code is free software; you can redistribute it and/or modify it 24.9 + * under the terms of the GNU General Public License version 2 only, as 24.10 + * published by the Free Software Foundation. Sun designates this 24.11 + * particular file as subject to the "Classpath" exception as provided 24.12 + * by Sun in the LICENSE file that accompanied this code. 24.13 + * 24.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 24.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.17 + * version 2 for more details (a copy is included in the LICENSE file that 24.18 + * accompanied this code). 24.19 + * 24.20 + * You should have received a copy of the GNU General Public License version 24.21 + * 2 along with this work; if not, write to the Free Software Foundation, 24.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.23 + * 24.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 24.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 24.26 + * have any questions. 24.27 + */ 24.28 + 24.29 +package pkg1; 24.30 + 24.31 +import java.io.IOException; 24.32 +import java.io.Serializable; 24.33 + 24.34 +/** 24.35 + * A class comment for testing. 24.36 + * 24.37 + * @author Bhavesh Patel 24.38 + * @see C2 24.39 + * @since JDK1.0 24.40 + */ 24.41 + 24.42 +public class C1 implements Serializable { 24.43 + 24.44 + /** 24.45 + * This field indicates whether the C1 is undecorated. 24.46 + * 24.47 + * @see #setUndecorated(boolean) 24.48 + * @since 1.4 24.49 + * @serial 24.50 + * @deprecated As of JDK version 1.5, replaced by 24.51 + * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}. 24.52 + */ 24.53 + @Deprecated 24.54 + public boolean undecorated = false; 24.55 + 24.56 + private String title; 24.57 + 24.58 + /** 24.59 + * This enum specifies the possible modal exclusion types. 24.60 + * 24.61 + * @since 1.6 24.62 + */ 24.63 + public static enum ModalExclusionType { 24.64 + /** 24.65 + * No modal exclusion. 24.66 + */ 24.67 + NO_EXCLUDE, 24.68 + /** 24.69 + * <code>APPLICATION_EXCLUDE</code> indicates that a top-level window 24.70 + * won't be blocked by any application-modal dialogs. Also, it isn't 24.71 + * blocked by document-modal dialogs from outside of its child hierarchy. 24.72 + */ 24.73 + APPLICATION_EXCLUDE 24.74 + }; 24.75 + 24.76 + /** 24.77 + * Constructor. 24.78 + * 24.79 + * @param title the title 24.80 + * @param test boolean value 24.81 + * @exception IllegalArgumentException if the <code>owner</code>'s 24.82 + * <code>GraphicsConfiguration</code> is not from a screen device 24.83 + * @exception HeadlessException 24.84 + */ 24.85 + public C1(String title, boolean test) { 24.86 + 24.87 + } 24.88 + 24.89 + public C1(String title) { 24.90 + 24.91 + } 24.92 + 24.93 + /** 24.94 + * Method comments. 24.95 + * @param undecorated <code>true</code> if no decorations are 24.96 + * to be enabled; 24.97 + * <code>false</code> if decorations are to be enabled. 24.98 + * @see #readObject() 24.99 + * @since 1.4 24.100 + */ 24.101 + public void setUndecorated(boolean undecorated) { 24.102 + /* Make sure we don't run in the middle of peer creation.*/ 24.103 + } 24.104 + 24.105 + /** 24.106 + * @see #setUndecorated(boolean) 24.107 + */ 24.108 + public void readObject() throws IOException { 24.109 + 24.110 + } 24.111 +}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java Tue Feb 24 07:55:30 2009 -0800 25.3 @@ -0,0 +1,86 @@ 25.4 +/* 25.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 + * 25.8 + * This code is free software; you can redistribute it and/or modify it 25.9 + * under the terms of the GNU General Public License version 2 only, as 25.10 + * published by the Free Software Foundation. Sun designates this 25.11 + * particular file as subject to the "Classpath" exception as provided 25.12 + * by Sun in the LICENSE file that accompanied this code. 25.13 + * 25.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.17 + * version 2 for more details (a copy is included in the LICENSE file that 25.18 + * accompanied this code). 25.19 + * 25.20 + * You should have received a copy of the GNU General Public License version 25.21 + * 2 along with this work; if not, write to the Free Software Foundation, 25.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.23 + * 25.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 25.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 25.26 + * have any questions. 25.27 + */ 25.28 + 25.29 +package pkg1; 25.30 + 25.31 +import java.io.ObjectInputStream; 25.32 +import java.io.IOException; 25.33 +import java.io.Serializable; 25.34 + 25.35 +/** 25.36 + * A class comment for testing. 25.37 + * 25.38 + * @author Bhavesh Patel 25.39 + * @see C1 25.40 + * @since JDK1.0 25.41 + */ 25.42 + 25.43 +public class C2 implements Serializable { 25.44 + 25.45 + /** 25.46 + * This field indicates title. 25.47 + */ 25.48 + String title; 25.49 + 25.50 + public static enum ModalType { 25.51 + NO_EXCLUDE 25.52 + }; 25.53 + 25.54 + /** 25.55 + * Constructor. 25.56 + * 25.57 + */ 25.58 + public C2() { 25.59 + 25.60 + } 25.61 + 25.62 + public C2(String title) { 25.63 + 25.64 + } 25.65 + 25.66 + /** 25.67 + * Set visible. 25.68 + * 25.69 + * @param set boolean 25.70 + * @since 1.4 25.71 + * @deprecated As of JDK version 1.5, replaced by 25.72 + * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}. 25.73 + */ 25.74 + @Deprecated 25.75 + public void setVisible(boolean set) { 25.76 + } 25.77 + 25.78 + /** 25.79 + * Reads the object stream. 25.80 + * 25.81 + * @param s ObjectInputStream 25.82 + * @throws <code>IOException</code> 25.83 + * @deprecated As of JDK version 1.5, replaced by 25.84 + * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}. 25.85 + */ 25.86 + @Deprecated 25.87 + public void readObject(ObjectInputStream s) throws IOException { 25.88 + } 25.89 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C3.java Tue Feb 24 07:55:30 2009 -0800 26.3 @@ -0,0 +1,65 @@ 26.4 +/* 26.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. Sun designates this 26.11 + * particular file as subject to the "Classpath" exception as provided 26.12 + * by Sun in the LICENSE file that accompanied this code. 26.13 + * 26.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.17 + * version 2 for more details (a copy is included in the LICENSE file that 26.18 + * accompanied this code). 26.19 + * 26.20 + * You should have received a copy of the GNU General Public License version 26.21 + * 2 along with this work; if not, write to the Free Software Foundation, 26.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.23 + * 26.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 26.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 26.26 + * have any questions. 26.27 + */ 26.28 + 26.29 +package pkg1; 26.30 + 26.31 +import java.io.Serializable; 26.32 + 26.33 +/** 26.34 + * Test for Serializable 26.35 + * 26.36 + * @author Bhavesh Patel 26.37 + * @deprecated This class is no longer used. 26.38 + */ 26.39 +@Deprecated 26.40 +public abstract class C3 implements Serializable { 26.41 + 26.42 + /** 26.43 + * The name for this class. 26.44 + * 26.45 + * @serial 26.46 + */ 26.47 + private String name; 26.48 + 26.49 + /** 26.50 + * @serial 26.51 + */ 26.52 + private int publicKey; 26.53 + 26.54 + /** 26.55 + * Constructor for serialization only. 26.56 + */ 26.57 + protected C3() { 26.58 + 26.59 + } 26.60 + 26.61 + /** 26.62 + * Prints general information. 26.63 + * 26.64 + */ 26.65 + public void printInfo() { 26.66 + 26.67 + } 26.68 +}
27.1 --- a/test/tools/javac/6304921/T6304921.out Thu Feb 19 14:08:22 2009 -0800 27.2 +++ b/test/tools/javac/6304921/T6304921.out Tue Feb 24 07:55:30 2009 -0800 27.3 @@ -1,18 +1,18 @@ 27.4 T6304921.java:671/671/680: warning: [rawtypes] found raw type: java.util.ArrayList 27.5 -missing type parameters for generic class java.util.ArrayList<E> 27.6 List<Integer> list = new ArrayList(); 27.7 ^ 27.8 + missing type parameters for generic class java.util.ArrayList<E> 27.9 T6304921.java:667/667/682: warning: [unchecked] unchecked conversion 27.10 -found : java.util.ArrayList 27.11 -required: java.util.List<java.lang.Integer> 27.12 List<Integer> list = new ArrayList(); 27.13 ^ 27.14 + required: java.util.List<java.lang.Integer> 27.15 + found: java.util.ArrayList 27.16 error: warnings found and -Werror specified 27.17 T6304921.java:727/733/737: cannot find symbol 27.18 -symbol : variable orr 27.19 -location: class java.lang.System 27.20 System.orr.println("abc"); // name not found 27.21 ^ 27.22 + symbol: variable orr 27.23 + location: class java.lang.System 27.24 T6304921.java:812/816/822: operator + cannot be applied to int,boolean 27.25 return 123 + true; // bad binary expression 27.26 ^
28.1 --- a/test/tools/javac/6668794/badClass/Test.java Thu Feb 19 14:08:22 2009 -0800 28.2 +++ b/test/tools/javac/6668794/badClass/Test.java Tue Feb 24 07:55:30 2009 -0800 28.3 @@ -54,8 +54,8 @@ 28.4 throw new Error("no diagnostics generated"); 28.5 28.6 String expected = "B.java:6:6: compiler.err.cant.access: p.A, " + 28.7 - "(- compiler.misc.bad.class.file.header: A.class, " + 28.8 - "(- compiler.misc.class.file.wrong.class: q.A))"; 28.9 + "(compiler.misc.bad.class.file.header: A.class, " + 28.10 + "(compiler.misc.class.file.wrong.class: q.A))"; 28.11 28.12 if (!out[0].equals(expected)) { 28.13 System.err.println("expected: " + expected);
29.1 --- a/test/tools/javac/6668794/badSource/Test.out Thu Feb 19 14:08:22 2009 -0800 29.2 +++ b/test/tools/javac/6668794/badSource/Test.out Tue Feb 24 07:55:30 2009 -0800 29.3 @@ -1,1 +1,1 @@ 29.4 -Test.java:10:6: compiler.err.cant.access: p.A, (- compiler.misc.bad.source.file.header: A.java, (- compiler.misc.file.doesnt.contain.class: p.A)) 29.5 +Test.java:10:6: compiler.err.cant.access: p.A, (compiler.misc.bad.source.file.header: A.java, (compiler.misc.file.doesnt.contain.class: p.A))
30.1 --- a/test/tools/javac/6758789/T6758789b.out Thu Feb 19 14:08:22 2009 -0800 30.2 +++ b/test/tools/javac/6758789/T6758789b.out Tue Feb 24 07:55:30 2009 -0800 30.3 @@ -1,4 +1,4 @@ 30.4 -T6758789b.java:39:11: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X> 30.5 +T6758789b.java:39:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X> 30.6 T6758789b.java:39:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a 30.7 - compiler.err.warnings.and.werror 30.8 1 error
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/test/tools/javac/Diagnostics/6769027/T6769027.java Tue Feb 24 07:55:30 2009 -0800 31.3 @@ -0,0 +1,499 @@ 31.4 +/* 31.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.7 + * 31.8 + * This code is free software; you can redistribute it and/or modify it 31.9 + * under the terms of the GNU General Public License version 2 only, as 31.10 + * published by the Free Software Foundation. 31.11 + * 31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 31.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 31.15 + * version 2 for more details (a copy is included in the LICENSE file that 31.16 + * accompanied this code). 31.17 + * 31.18 + * You should have received a copy of the GNU General Public License version 31.19 + * 2 along with this work; if not, write to the Free Software Foundation, 31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 31.21 + * 31.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 31.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 31.24 + * have any questions. 31.25 + */ 31.26 + 31.27 +/** 31.28 + * @test 31.29 + * @bug 6769027 31.30 + * @summary Source line should be displayed immediately after the first diagnostic line 31.31 + * @author Maurizio Cimadamore 31.32 + * @run main/othervm T6769027 31.33 + */ 31.34 +import java.net.URI; 31.35 +import java.util.regex.Matcher; 31.36 +import javax.tools.*; 31.37 +import com.sun.tools.javac.util.*; 31.38 + 31.39 +public class T6769027 { 31.40 + 31.41 + enum OutputKind { 31.42 + RAW("rawDiagnostics","rawDiagnostics"), 31.43 + BASIC("",""); 31.44 + 31.45 + String key; 31.46 + String value; 31.47 + 31.48 + void init(Options opts) { 31.49 + opts.put(key, value); 31.50 + } 31.51 + 31.52 + OutputKind(String key, String value) { 31.53 + this.key = key; 31.54 + this.value = value; 31.55 + } 31.56 + } 31.57 + 31.58 + enum CaretKind { 31.59 + DEFAULT("", ""), 31.60 + SHOW("showCaret","true"), 31.61 + HIDE("showCaret","false"); 31.62 + 31.63 + String key; 31.64 + String value; 31.65 + 31.66 + void init(Options opts) { 31.67 + opts.put(key, value); 31.68 + } 31.69 + 31.70 + CaretKind(String key, String value) { 31.71 + this.key = key; 31.72 + this.value = value; 31.73 + } 31.74 + 31.75 + boolean isEnabled() { 31.76 + return this == DEFAULT || this == SHOW; 31.77 + } 31.78 + } 31.79 + 31.80 + enum SourceLineKind { 31.81 + DEFAULT("", ""), 31.82 + AFTER_SUMMARY("sourcePosition", "top"), 31.83 + BOTTOM("sourcePosition", "bottom"); 31.84 + 31.85 + String key; 31.86 + String value; 31.87 + 31.88 + void init(Options opts) { 31.89 + opts.put(key, value); 31.90 + } 31.91 + 31.92 + SourceLineKind(String key, String value) { 31.93 + this.key = key; 31.94 + this.value = value; 31.95 + } 31.96 + 31.97 + boolean isAfterSummary() { 31.98 + return this == DEFAULT || this == AFTER_SUMMARY; 31.99 + } 31.100 + } 31.101 + 31.102 + enum XDiagsSource { 31.103 + DEFAULT(""), 31.104 + SOURCE("source"), 31.105 + NO_SOURCE("-source"); 31.106 + 31.107 + String flag; 31.108 + 31.109 + void init(Options opts) { 31.110 + if (this != DEFAULT) { 31.111 + String flags = opts.get("diags"); 31.112 + flags = flags == null ? flag : flags + "," + flag; 31.113 + opts.put("diags", flags); 31.114 + } 31.115 + } 31.116 + 31.117 + XDiagsSource(String flag) { 31.118 + this.flag = flag; 31.119 + } 31.120 + 31.121 + String getOutput(CaretKind caretKind, IndentKind indent, OutputKind outKind) { 31.122 + String spaces = (outKind == OutputKind.BASIC) ? indent.string : ""; 31.123 + return "\n" + spaces + "This is a source line" + 31.124 + (caretKind.isEnabled() ? "\n" + spaces + " ^" : ""); 31.125 + } 31.126 + } 31.127 + 31.128 + enum XDiagsCompact { 31.129 + DEFAULT(""), 31.130 + COMPACT("short"), 31.131 + NO_COMPACT("-short"); 31.132 + 31.133 + String flag; 31.134 + 31.135 + void init(Options opts) { 31.136 + if (this != DEFAULT) { 31.137 + String flags = opts.get("diags"); 31.138 + flags = flags == null ? flag : flags + "," + flag; 31.139 + opts.put("diags", flags); 31.140 + } 31.141 + } 31.142 + 31.143 + XDiagsCompact(String flag) { 31.144 + this.flag = flag; 31.145 + } 31.146 + } 31.147 + 31.148 + enum ErrorKind { 31.149 + SINGLE("single", 31.150 + "compiler.err.single: Hello!", 31.151 + "KXThis is a test error message Hello!"), 31.152 + DOUBLE("double", 31.153 + "compiler.err.double: Hello!", 31.154 + "KXThis is a test error message.\n" + 31.155 + "KXYThis is another line of the above error message Hello!"); 31.156 + 31.157 + String key; 31.158 + String rawOutput; 31.159 + String nonRawOutput; 31.160 + 31.161 + String key() { 31.162 + return key; 31.163 + } 31.164 + 31.165 + ErrorKind(String key, String rawOutput, String nonRawOutput) { 31.166 + this.key = key; 31.167 + this.rawOutput = rawOutput; 31.168 + this.nonRawOutput = nonRawOutput; 31.169 + } 31.170 + 31.171 + String getOutput(OutputKind outKind, IndentKind summaryIndent, IndentKind detailsIndent) { 31.172 + return outKind == OutputKind.RAW ? 31.173 + rawOutput : 31.174 + nonRawOutput.replace("X", summaryIndent.string).replace("Y", detailsIndent.string).replace("K", ""); 31.175 + } 31.176 + 31.177 + String getOutput(OutputKind outKind, IndentKind summaryIndent, IndentKind detailsIndent, String indent) { 31.178 + return outKind == OutputKind.RAW ? 31.179 + rawOutput : 31.180 + nonRawOutput.replace("X", summaryIndent.string).replace("Y", detailsIndent.string).replace("K", indent); 31.181 + } 31.182 + } 31.183 + 31.184 + enum MultilineKind { 31.185 + NONE(0), 31.186 + DOUBLE(1), 31.187 + NESTED(2), 31.188 + DOUBLE_NESTED(3); 31.189 + 31.190 + static String[][] rawTemplates = { 31.191 + {"", ",{(E),(E)}", ",{(E,{(E)})}", ",{(E,{(E)}),(E,{(E)})}"}, //ENABLED 31.192 + {"", "", "", "",""}, //DISABLED 31.193 + {"", ",{(E)}", ",{(E,{(E)})}", ",{(E,{(E)})}"}, //LIMIT_LENGTH 31.194 + {"", ",{(E),(E)}", ",{(E)}", ",{(E),(E)}"}, //LIMIT_DEPTH 31.195 + {"", ",{(E)}", ",{(E)}", ",{(E)}"}}; //LIMIT_BOTH 31.196 + 31.197 + static String[][] basicTemplates = { 31.198 + {"", "\nE\nE", "\nE\nQ", "\nE\nQ\nE\nQ"}, //ENABLED 31.199 + {"", "", "", "",""}, //DISABLED 31.200 + {"", "\nE", "\nE\nQ", "\nE\nQ"}, //LIMIT_LENGTH 31.201 + {"", "\nE\nE", "\nE", "\nE\nE"}, //LIMIT_DEPTH 31.202 + {"", "\nE", "\nE", "\nE"}}; //LIMIT_BOTH 31.203 + 31.204 + 31.205 + int index; 31.206 + 31.207 + MultilineKind (int index) { 31.208 + this.index = index; 31.209 + } 31.210 + 31.211 + boolean isDouble() { 31.212 + return this == DOUBLE || this == DOUBLE_NESTED; 31.213 + } 31.214 + 31.215 + boolean isNested() { 31.216 + return this == NESTED || this == DOUBLE_NESTED; 31.217 + } 31.218 + 31.219 + String getOutput(OutputKind outKind, ErrorKind errKind, MultilinePolicy policy, 31.220 + IndentKind summaryIndent, IndentKind detailsIndent, IndentKind multiIndent) { 31.221 + String constIndent = (errKind == ErrorKind.DOUBLE) ? 31.222 + summaryIndent.string + detailsIndent.string : 31.223 + summaryIndent.string; 31.224 + constIndent += multiIndent.string; 31.225 + 31.226 + String errMsg1 = errKind.getOutput(outKind, summaryIndent, detailsIndent, constIndent); 31.227 + String errMsg2 = errKind.getOutput(outKind, summaryIndent, detailsIndent, constIndent + constIndent); 31.228 + 31.229 + errMsg1 = errMsg1.replaceAll("compiler.err", "compiler.misc"); 31.230 + errMsg1 = errMsg1.replaceAll("error message", "subdiagnostic"); 31.231 + errMsg2 = errMsg2.replaceAll("compiler.err", "compiler.misc"); 31.232 + errMsg2 = errMsg2.replaceAll("error message", "subdiagnostic"); 31.233 + 31.234 + String template = outKind == OutputKind.RAW ? 31.235 + rawTemplates[policy.index][index] : 31.236 + basicTemplates[policy.index][index]; 31.237 + 31.238 + template = template.replaceAll("E", errMsg1); 31.239 + return template.replaceAll("Q", errMsg2); 31.240 + } 31.241 + } 31.242 + 31.243 + enum MultilinePolicy { 31.244 + ENABLED(0, "multilinePolicy", "enabled"), 31.245 + DISABLED(1, "multilinePolicy", "disabled"), 31.246 + LIMIT_LENGTH(2, "multilinePolicy", "limit:1:*"), 31.247 + LIMIT_DEPTH(3, "multilinePolicy", "limit:*:1"), 31.248 + LIMIT_BOTH(4, "multilinePolicy", "limit:1:1"); 31.249 + 31.250 + String name; 31.251 + String value; 31.252 + int index; 31.253 + 31.254 + MultilinePolicy(int index, String name, String value) { 31.255 + this.name = name; 31.256 + this.value = value; 31.257 + this.index = index; 31.258 + } 31.259 + 31.260 + void init(Options options) { 31.261 + options.put(name, value); 31.262 + } 31.263 + } 31.264 + 31.265 + enum PositionKind { 31.266 + NOPOS(Position.NOPOS, "- ", "error: "), 31.267 + POS(5, "/Test.java:1:6: ", "myfo:/Test.java:1: "); 31.268 + 31.269 + int pos; 31.270 + String rawOutput; 31.271 + String nonRawOutput; 31.272 + 31.273 + PositionKind(int pos, String rawOutput, String nonRawOutput) { 31.274 + this.pos = pos; 31.275 + this.rawOutput = rawOutput; 31.276 + this.nonRawOutput = nonRawOutput; 31.277 + } 31.278 + 31.279 + JCDiagnostic.DiagnosticPosition pos() { 31.280 + return new JCDiagnostic.SimpleDiagnosticPosition(pos); 31.281 + } 31.282 + 31.283 + String getOutput(OutputKind outputKind) { 31.284 + return outputKind == OutputKind.RAW ? 31.285 + rawOutput : 31.286 + nonRawOutput; 31.287 + } 31.288 + } 31.289 + 31.290 + static class MyFileObject extends SimpleJavaFileObject { 31.291 + private String text; 31.292 + public MyFileObject(String text) { 31.293 + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); 31.294 + this.text = text; 31.295 + } 31.296 + @Override 31.297 + public CharSequence getCharContent(boolean ignoreEncodingErrors) { 31.298 + return text; 31.299 + } 31.300 + } 31.301 + 31.302 + enum IndentKind { 31.303 + NONE(""), 31.304 + CUSTOM(" "); 31.305 + 31.306 + String string; 31.307 + 31.308 + IndentKind(String indent) { 31.309 + string = indent; 31.310 + } 31.311 + } 31.312 + 31.313 + class MyLog extends Log { 31.314 + MyLog(Context ctx) { 31.315 + super(ctx); 31.316 + } 31.317 + 31.318 + @Override 31.319 + protected java.io.PrintWriter getWriterForDiagnosticType(JCDiagnostic.DiagnosticType dt) { 31.320 + return new java.io.PrintWriter(System.out); 31.321 + } 31.322 + 31.323 + @Override 31.324 + protected boolean shouldReport(JavaFileObject jfo, int pos) { 31.325 + return true; 31.326 + } 31.327 + } 31.328 + 31.329 + int nerrors = 0; 31.330 + 31.331 + void exec(OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind, 31.332 + MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource, 31.333 + XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind, 31.334 + IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent, 31.335 + IndentKind subdiagsIndent) { 31.336 + Context ctx = new Context(); 31.337 + Options options = Options.instance(ctx); 31.338 + outputKind.init(options); 31.339 + multiPolicy.init(options); 31.340 + xdiagsSource.init(options); 31.341 + xdiagsCompact.init(options); 31.342 + caretKind.init(options); 31.343 + sourceLineKind.init(options); 31.344 + String indentString = ""; 31.345 + indentString = (summaryIndent == IndentKind.CUSTOM) ? "3" : "0"; 31.346 + indentString += (detailsIndent == IndentKind.CUSTOM) ? "|3" : "|0"; 31.347 + indentString += (sourceIndent == IndentKind.CUSTOM) ? "|3" : "|0"; 31.348 + indentString += (subdiagsIndent == IndentKind.CUSTOM) ? "|3" : "|0"; 31.349 + options.put("diagsIndentation", indentString); 31.350 + MyLog log = new MyLog(ctx); 31.351 + JavacMessages messages = JavacMessages.instance(ctx); 31.352 + messages.add("tester"); 31.353 + JCDiagnostic.Factory diags = JCDiagnostic.Factory.instance(ctx); 31.354 + log.useSource(new MyFileObject("This is a source line")); 31.355 + JCDiagnostic d = diags.error(log.currentSource(), 31.356 + posKind.pos(), 31.357 + errorKind.key(), "Hello!"); 31.358 + if (multiKind != MultilineKind.NONE) { 31.359 + JCDiagnostic sub = diags.fragment(errorKind.key(), "Hello!"); 31.360 + if (multiKind.isNested()) 31.361 + sub = new JCDiagnostic.MultilineDiagnostic(sub, List.of(sub)); 31.362 + List<JCDiagnostic> subdiags = multiKind.isDouble() ? 31.363 + List.of(sub, sub) : 31.364 + List.of(sub); 31.365 + d = new JCDiagnostic.MultilineDiagnostic(d, subdiags); 31.366 + } 31.367 + String diag = log.getDiagnosticFormatter().format(d, messages.getCurrentLocale()); 31.368 + checkOutput(diag, 31.369 + outputKind, 31.370 + errorKind, 31.371 + multiKind, 31.372 + multiPolicy, 31.373 + posKind, 31.374 + xdiagsSource, 31.375 + xdiagsCompact, 31.376 + caretKind, 31.377 + sourceLineKind, 31.378 + summaryIndent, 31.379 + detailsIndent, 31.380 + sourceIndent, 31.381 + subdiagsIndent); 31.382 + } 31.383 + 31.384 + void test() { 31.385 + for (OutputKind outputKind : OutputKind.values()) { 31.386 + for (ErrorKind errKind : ErrorKind.values()) { 31.387 + for (MultilineKind multiKind : MultilineKind.values()) { 31.388 + for (MultilinePolicy multiPolicy : MultilinePolicy.values()) { 31.389 + for (PositionKind posKind : PositionKind.values()) { 31.390 + for (XDiagsSource xdiagsSource : XDiagsSource.values()) { 31.391 + for (XDiagsCompact xdiagsCompact : XDiagsCompact.values()) { 31.392 + for (CaretKind caretKind : CaretKind.values()) { 31.393 + for (SourceLineKind sourceLineKind : SourceLineKind.values()) { 31.394 + for (IndentKind summaryIndent : IndentKind.values()) { 31.395 + for (IndentKind detailsIndent : IndentKind.values()) { 31.396 + for (IndentKind sourceIndent : IndentKind.values()) { 31.397 + for (IndentKind subdiagsIndent : IndentKind.values()) { 31.398 + exec(outputKind, 31.399 + errKind, 31.400 + multiKind, 31.401 + multiPolicy, 31.402 + posKind, 31.403 + xdiagsSource, 31.404 + xdiagsCompact, 31.405 + caretKind, 31.406 + sourceLineKind, 31.407 + summaryIndent, 31.408 + detailsIndent, 31.409 + sourceIndent, 31.410 + subdiagsIndent); 31.411 + } 31.412 + } 31.413 + } 31.414 + } 31.415 + } 31.416 + } 31.417 + } 31.418 + } 31.419 + } 31.420 + } 31.421 + } 31.422 + } 31.423 + } 31.424 + if (nerrors != 0) 31.425 + throw new AssertionError(nerrors + " errors found"); 31.426 + } 31.427 + 31.428 + void printInfo(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind, 31.429 + MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource, 31.430 + XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind, 31.431 + IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent, 31.432 + IndentKind subdiagsIndent, String errorLine) { 31.433 + String sep = "*********************************************************"; 31.434 + String desc = "raw=" + outputKind + " pos=" + posKind + " key=" + errorKind.key() + 31.435 + " multiline=" + multiKind +" multiPolicy=" + multiPolicy.value + 31.436 + " diags= " + java.util.Arrays.asList(xdiagsSource.flag, xdiagsCompact.flag) + 31.437 + " caret=" + caretKind + " sourcePosition=" + sourceLineKind + 31.438 + " summaryIndent=" + summaryIndent + " detailsIndent=" + detailsIndent + 31.439 + " sourceIndent=" + sourceIndent + " subdiagsIndent=" + subdiagsIndent; 31.440 + System.out.println(sep); 31.441 + System.out.println(desc); 31.442 + System.out.println(sep); 31.443 + System.out.println(msg); 31.444 + System.out.println("Diagnostic formatting problem - expected diagnostic...\n" + errorLine); 31.445 + } 31.446 + 31.447 + void checkOutput(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind, 31.448 + MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource, 31.449 + XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind, 31.450 + IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent, 31.451 + IndentKind subdiagsIndent) { 31.452 + boolean shouldPrintSource = posKind == PositionKind.POS && 31.453 + xdiagsSource != XDiagsSource.NO_SOURCE && 31.454 + (xdiagsSource == XDiagsSource.SOURCE || 31.455 + outputKind == OutputKind.BASIC); 31.456 + String errorLine = posKind.getOutput(outputKind) + 31.457 + errorKind.getOutput(outputKind, summaryIndent, detailsIndent); 31.458 + if (xdiagsCompact != XDiagsCompact.COMPACT) 31.459 + errorLine += multiKind.getOutput(outputKind, errorKind, multiPolicy, summaryIndent, detailsIndent, subdiagsIndent); 31.460 + String[] lines = errorLine.split("\n"); 31.461 + if (xdiagsCompact == XDiagsCompact.COMPACT) { 31.462 + errorLine = lines[0]; 31.463 + lines = new String[] {errorLine}; 31.464 + } 31.465 + if (shouldPrintSource) { 31.466 + if (sourceLineKind.isAfterSummary()) { 31.467 + String sep = "\n"; 31.468 + if (lines.length == 1) { 31.469 + errorLine += "\n"; 31.470 + sep = ""; 31.471 + } 31.472 + errorLine = errorLine.replaceFirst("\n", 31.473 + Matcher.quoteReplacement(xdiagsSource.getOutput(caretKind, sourceIndent, outputKind) + sep)); 31.474 + } 31.475 + else 31.476 + errorLine += xdiagsSource.getOutput(caretKind, sourceIndent, outputKind); 31.477 + } 31.478 + 31.479 + if (!msg.equals(errorLine)) { 31.480 + printInfo(msg, 31.481 + outputKind, 31.482 + errorKind, 31.483 + multiKind, 31.484 + multiPolicy, 31.485 + posKind, 31.486 + xdiagsSource, 31.487 + xdiagsCompact, 31.488 + caretKind, 31.489 + sourceLineKind, 31.490 + summaryIndent, 31.491 + detailsIndent, 31.492 + sourceIndent, 31.493 + subdiagsIndent, 31.494 + errorLine); 31.495 + nerrors++; 31.496 + } 31.497 + } 31.498 + 31.499 + public static void main(String... args) throws Exception { 31.500 + new T6769027().test(); 31.501 + } 31.502 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/test/tools/javac/Diagnostics/6769027/tester.properties Tue Feb 24 07:55:30 2009 -0800 32.3 @@ -0,0 +1,13 @@ 32.4 +compiler.err.single=\ 32.5 + This is a test error message {0} 32.6 + 32.7 +compiler.err.double=\ 32.8 + This is a test error message.\n\ 32.9 + This is another line of the above error message {0} 32.10 + 32.11 +compiler.misc.single=\ 32.12 + This is a test subdiagnostic {0} 32.13 + 32.14 +compiler.misc.double=\ 32.15 + This is a test subdiagnostic.\n\ 32.16 + This is another line of the above subdiagnostic {0}
33.1 --- a/test/tools/javac/ExtendArray.out Thu Feb 19 14:08:22 2009 -0800 33.2 +++ b/test/tools/javac/ExtendArray.out Tue Feb 24 07:55:30 2009 -0800 33.3 @@ -1,6 +1,6 @@ 33.4 ExtendArray.java:11: unexpected type 33.5 -found : java.lang.Object[] 33.6 -required: class 33.7 public class ExtendArray extends Object[] {} 33.8 ^ 33.9 + required: class 33.10 + found: java.lang.Object[] 33.11 1 error
34.1 --- a/test/tools/javac/T5048776b.out Thu Feb 19 14:08:22 2009 -0800 34.2 +++ b/test/tools/javac/T5048776b.out Tue Feb 24 07:55:30 2009 -0800 34.3 @@ -1,3 +1,3 @@ 34.4 -T5048776.java:12:10: compiler.warn.override.varargs.missing: (- compiler.misc.varargs.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1) 34.5 -T5048776.java:20:10: compiler.warn.override.varargs.extra: (- compiler.misc.varargs.override: foo(java.lang.Object[]), A2a, foo(java.lang.Object...), A2) 34.6 +T5048776.java:12:10: compiler.warn.override.varargs.missing: (compiler.misc.varargs.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1) 34.7 +T5048776.java:20:10: compiler.warn.override.varargs.extra: (compiler.misc.varargs.override: foo(java.lang.Object[]), A2a, foo(java.lang.Object...), A2) 34.8 2 warnings
35.1 --- a/test/tools/javac/T6214885a.out Thu Feb 19 14:08:22 2009 -0800 35.2 +++ b/test/tools/javac/T6214885a.out Tue Feb 24 07:55:30 2009 -0800 35.3 @@ -1,6 +1,6 @@ 35.4 T6214885.java:11 cannot find symbol 35.5 -symbol : variable x 35.6 -location: class T6214885 35.7 x = 1; 35.8 ^ 35.9 + symbol: variable x 35.10 + location: class T6214885 35.11 1 error
36.1 --- a/test/tools/javac/T6214885b.out Thu Feb 19 14:08:22 2009 -0800 36.2 +++ b/test/tools/javac/T6214885b.out Tue Feb 24 07:55:30 2009 -0800 36.3 @@ -1,6 +1,6 @@ 36.4 T6214885.java:11:9 cannot find symbol 36.5 -symbol : variable x 36.6 -location: class T6214885 36.7 x = 1; 36.8 ^ 36.9 + symbol: variable x 36.10 + location: class T6214885 36.11 1 error
37.1 --- a/test/tools/javac/T6230128.out Thu Feb 19 14:08:22 2009 -0800 37.2 +++ b/test/tools/javac/T6230128.out Tue Feb 24 07:55:30 2009 -0800 37.3 @@ -1,2 +1,2 @@ 37.4 -T6230128.java:11:10: compiler.err.override.weaker.access: (- compiler.misc.cant.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1), public 37.5 +T6230128.java:11:10: compiler.err.override.weaker.access: (compiler.misc.cant.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1), public 37.6 1 error
38.1 --- a/test/tools/javac/annotations/6365854/test1.out Thu Feb 19 14:08:22 2009 -0800 38.2 +++ b/test/tools/javac/annotations/6365854/test1.out Tue Feb 24 07:55:30 2009 -0800 38.3 @@ -1,2 +1,2 @@ 38.4 -- compiler.warn.annotation.method.not.found.reason: test.annotation.TestAnnotation, test, (- compiler.misc.class.file.not.found: test.annotation.TestAnnotation) 38.5 +- compiler.warn.annotation.method.not.found.reason: test.annotation.TestAnnotation, test, (compiler.misc.class.file.not.found: test.annotation.TestAnnotation) 38.6 1 warning
39.1 --- a/test/tools/javac/cast/6557182/T6557182.out Thu Feb 19 14:08:22 2009 -0800 39.2 +++ b/test/tools/javac/cast/6557182/T6557182.out Tue Feb 24 07:55:30 2009 -0800 39.3 @@ -1,4 +1,4 @@ 39.4 -T6557182.java:35:56: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer> 39.5 -T6557182.java:39:56: compiler.warn.prob.found.req: (- compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer> 39.6 +T6557182.java:35:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer> 39.7 +T6557182.java:39:56: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer> 39.8 1 error 39.9 1 warning
40.1 --- a/test/tools/javac/cast/6665356/T6665356.out Thu Feb 19 14:08:22 2009 -0800 40.2 +++ b/test/tools/javac/cast/6665356/T6665356.out Tue Feb 24 07:55:30 2009 -0800 40.3 @@ -1,8 +1,8 @@ 40.4 -T6665356.java:54:55: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long> 40.5 -T6665356.java:58:58: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number> 40.6 -T6665356.java:62:65: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number> 40.7 -T6665356.java:66:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long> 40.8 -T6665356.java:70:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String> 40.9 -T6665356.java:74:55: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long> 40.10 -T6665356.java:78:58: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String> 40.11 +T6665356.java:54:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long> 40.12 +T6665356.java:58:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number> 40.13 +T6665356.java:62:65: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number> 40.14 +T6665356.java:66:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long> 40.15 +T6665356.java:70:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String> 40.16 +T6665356.java:74:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long> 40.17 +T6665356.java:78:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String> 40.18 7 errors 40.19 \ No newline at end of file
41.1 --- a/test/tools/javac/cast/6795580/T6795580.out Thu Feb 19 14:08:22 2009 -0800 41.2 +++ b/test/tools/javac/cast/6795580/T6795580.out Tue Feb 24 07:55:30 2009 -0800 41.3 @@ -1,8 +1,8 @@ 41.4 -T6795580.java:54:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[] 41.5 -T6795580.java:58:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[] 41.6 -T6795580.java:62:67: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[] 41.7 -T6795580.java:66:59: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[] 41.8 -T6795580.java:70:62: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[] 41.9 -T6795580.java:74:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[] 41.10 -T6795580.java:78:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[] 41.11 +T6795580.java:54:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[] 41.12 +T6795580.java:58:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[] 41.13 +T6795580.java:62:67: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[] 41.14 +T6795580.java:66:59: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[] 41.15 +T6795580.java:70:62: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[] 41.16 +T6795580.java:74:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[] 41.17 +T6795580.java:78:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[] 41.18 7 errors
42.1 --- a/test/tools/javac/generics/6207386/T6207386.out Thu Feb 19 14:08:22 2009 -0800 42.2 +++ b/test/tools/javac/generics/6207386/T6207386.out Tue Feb 24 07:55:30 2009 -0800 42.3 @@ -1,2 +1,2 @@ 42.4 -T6207386.java:13:30: compiler.err.prob.found.req: (- compiler.misc.incompatible.types), X, T6207386.F<? super X> 42.5 +T6207386.java:13:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), X, T6207386.F<? super X> 42.6 1 error
43.1 --- a/test/tools/javac/generics/inference/6315770/T6315770.out Thu Feb 19 14:08:22 2009 -0800 43.2 +++ b/test/tools/javac/generics/inference/6315770/T6315770.out Tue Feb 24 07:55:30 2009 -0800 43.3 @@ -1,3 +1,3 @@ 43.4 -T6315770.java:39:42: compiler.err.undetermined.type.1: <T>T6315770<T>, (- compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable) 43.5 -T6315770.java:40:40: compiler.err.prob.found.req: (- compiler.misc.incompatible.types.1: (- compiler.misc.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String> 43.6 +T6315770.java:39:42: compiler.err.undetermined.type.1: <T>T6315770<T>, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable) 43.7 +T6315770.java:40:40: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String> 43.8 2 errors
44.1 --- a/test/tools/javac/generics/inference/6718364/T6718364.out Thu Feb 19 14:08:22 2009 -0800 44.2 +++ b/test/tools/javac/generics/inference/6718364/T6718364.out Tue Feb 24 07:55:30 2009 -0800 44.3 @@ -1,3 +1,3 @@ 44.4 -T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer> 44.5 +T6718364.java:36:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer> 44.6 T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X<T>,T, T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X, kindname.class, T6718364 44.7 2 warnings 44.8 \ No newline at end of file
45.1 --- a/test/tools/javac/generics/typevars/6680106/T6680106.out Thu Feb 19 14:08:22 2009 -0800 45.2 +++ b/test/tools/javac/generics/typevars/6680106/T6680106.out Tue Feb 24 07:55:30 2009 -0800 45.3 @@ -1,13 +1,13 @@ 45.4 -T6680106.java:34:25: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) 45.5 -T6680106.java:35:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) 45.6 -T6680106.java:35:40: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) 45.7 -T6680106.java:36:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) 45.8 -T6680106.java:36:40: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class) 45.9 -T6680106.java:36:55: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) 45.10 -T6680106.java:37:30: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) 45.11 -T6680106.java:38:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) 45.12 -T6680106.java:38:50: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) 45.13 -T6680106.java:39:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) 45.14 -T6680106.java:39:50: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class) 45.15 -T6680106.java:39:70: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) 45.16 +T6680106.java:34:25: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) 45.17 +T6680106.java:35:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) 45.18 +T6680106.java:35:40: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) 45.19 +T6680106.java:36:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) 45.20 +T6680106.java:36:40: compiler.err.type.found.req: U[], (compiler.misc.type.req.class) 45.21 +T6680106.java:36:55: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) 45.22 +T6680106.java:37:30: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) 45.23 +T6680106.java:38:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) 45.24 +T6680106.java:38:50: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) 45.25 +T6680106.java:39:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) 45.26 +T6680106.java:39:50: compiler.err.type.found.req: U[], (compiler.misc.type.req.class) 45.27 +T6680106.java:39:70: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) 45.28 12 errors 45.29 \ No newline at end of file
46.1 --- a/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.out Thu Feb 19 14:08:22 2009 -0800 46.2 +++ b/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.out Tue Feb 24 07:55:30 2009 -0800 46.3 @@ -1,5 +1,5 @@ 46.4 MissingSuperRecovery.java:15: cannot access base 46.5 -class file for base not found 46.6 public class MissingSuperRecovery extends impl { 46.7 ^ 46.8 + class file for base not found 46.9 1 error
47.1 --- a/test/tools/javac/unicode/UnicodeNewline.out Thu Feb 19 14:08:22 2009 -0800 47.2 +++ b/test/tools/javac/unicode/UnicodeNewline.out Tue Feb 24 07:55:30 2009 -0800 47.3 @@ -1,6 +1,6 @@ 47.4 UnicodeNewline.java:11: cannot find symbol 47.5 -symbol : class xyzzy 47.6 -location: class UnicodeNewline 47.7 xyzzy plugh; // error should be HERE 47.8 ^ 47.9 + symbol: class xyzzy 47.10 + location: class UnicodeNewline 47.11 1 error