Merge

Thu, 19 Feb 2009 18:04:54 -0800

author
tbell
date
Thu, 19 Feb 2009 18:04:54 -0800
changeset 223
f4717c901346
parent 218
c53007f34195
parent 222
d424ed561993
child 225
c4d3cbe3765a

Merge

     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Feb 17 09:07:14 2009 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     4.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/SerializedFormWriter.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     5.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     6.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     7.2 +++ b/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     8.2 +++ b/src/share/classes/com/sun/tools/javac/api/Messages.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
     9.2 +++ b/src/share/classes/com/sun/tools/javac/main/OptionName.java	Thu Feb 19 18:04:54 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	Tue Feb 17 09:07:14 2009 -0800
    10.2 +++ b/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java	Thu Feb 19 18:04:54 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/resources/compiler.properties	Tue Feb 17 09:07:14 2009 -0800
    11.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 19 18:04:54 2009 -0800
    11.3 @@ -907,16 +907,16 @@
    11.4  
    11.5  compiler.err.prob.found.req=\
    11.6  {0}\n\
    11.7 -found   : {1}\n\
    11.8 -required: {2}
    11.9 +required: {2}\n\
   11.10 +found:    {1}
   11.11  compiler.warn.prob.found.req=\
   11.12  {0}\n\
   11.13 -found   : {1}\n\
   11.14 -required: {2}
   11.15 +required: {2}\n\
   11.16 +found:    {1}
   11.17  compiler.err.prob.found.req.1=\
   11.18  {0} {3}\n\
   11.19 -found   : {1}\n\
   11.20 -required: {2}
   11.21 +required: {2}\n\
   11.22 +found:    {1}
   11.23  
   11.24  ## The following are all possible strings for the first argument ({0}) of the
   11.25  ## above strings.
   11.26 @@ -951,8 +951,8 @@
   11.27  
   11.28  compiler.err.type.found.req=\
   11.29  unexpected type\n\
   11.30 -found   : {0}\n\
   11.31 -required: {1}
   11.32 +required: {1}\n\
   11.33 +found:    {0}
   11.34  
   11.35  ## The following are all possible strings for the first argument ({0}) of the
   11.36  ## above string.
   11.37 @@ -1003,7 +1003,7 @@
   11.38  compiler.err.unexpected.type=\
   11.39  unexpected type\n\
   11.40  required: {0}\n\
   11.41 -found   : {1}
   11.42 +found:    {1}
   11.43  
   11.44  ## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.)
   11.45  ## The second argument {1} is the non-resolved symbol
   11.46 @@ -1026,17 +1026,17 @@
   11.47  ## The sixth argument {5} is the location type
   11.48  compiler.err.cant.resolve.location=\
   11.49      cannot find symbol\n\
   11.50 -    symbol  : {0} {1}\n\
   11.51 +    symbol:   {0} {1}\n\
   11.52      location: {4} {5}
   11.53  
   11.54  compiler.err.cant.resolve.location.args=\
   11.55      cannot find symbol\n\
   11.56 -    symbol  : {0} {1}({3})\n\
   11.57 +    symbol:   {0} {1}({3})\n\
   11.58      location: {4} {5}
   11.59  
   11.60  compiler.err.cant.resolve.location.args.params=\
   11.61      cannot find symbol\n\
   11.62 -    symbol  : {0} <{2}>{1}({3})\n\
   11.63 +    symbol:   {0} <{2}>{1}({3})\n\
   11.64      location: {4} {5}
   11.65  
   11.66  ## The following are all possible string for "kindname".
    12.1 --- a/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Tue Feb 17 09:07:14 2009 -0800
    12.2 +++ b/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 19 18:04:54 2009 -0800
    12.3 @@ -24,16 +24,23 @@
    12.4   */
    12.5  package com.sun.tools.javac.util;
    12.6  
    12.7 +import java.util.Arrays;
    12.8  import java.util.Collection;
    12.9 +import java.util.EnumSet;
   12.10 +import java.util.HashMap;
   12.11  import java.util.Locale;
   12.12 +import java.util.Map;
   12.13 +import java.util.Set;
   12.14  import javax.tools.JavaFileObject;
   12.15  
   12.16  import com.sun.tools.javac.api.DiagnosticFormatter;
   12.17 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.DiagnosticPart;
   12.18 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.MultilineLimit;
   12.19 +import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind;
   12.20  import com.sun.tools.javac.api.Formattable;
   12.21 -import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind;
   12.22  import com.sun.tools.javac.file.JavacFileManager;
   12.23 +
   12.24  import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
   12.25 -import static com.sun.tools.javac.util.LayoutCharacters.*;
   12.26  
   12.27  /**
   12.28   * This abstract class provides a basic implementation of the functionalities that should be provided
   12.29 @@ -50,35 +57,19 @@
   12.30  public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter<JCDiagnostic> {
   12.31  
   12.32      /**
   12.33 -     * JavacMessages object used by this formatter for i18n
   12.34 +     * JavacMessages object used by this formatter for i18n.
   12.35       */
   12.36      protected JavacMessages messages;
   12.37 -    protected boolean showSource;
   12.38 +    private SimpleConfiguration config;
   12.39 +    protected int depth = 0;
   12.40  
   12.41      /**
   12.42 -     * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object
   12.43 +     * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object.
   12.44       * @param messages
   12.45       */
   12.46 -    protected AbstractDiagnosticFormatter(JavacMessages messages, Options options, boolean showSource) {
   12.47 +    protected AbstractDiagnosticFormatter(JavacMessages messages, SimpleConfiguration config) {
   12.48          this.messages = messages;
   12.49 -        this.showSource = options.get("showSource") == null ? showSource :
   12.50 -                          options.get("showSource").equals("true");
   12.51 -    }
   12.52 -
   12.53 -    protected AbstractDiagnosticFormatter(JavacMessages messages, boolean showSource) {
   12.54 -        this.messages = messages;
   12.55 -        this.showSource = showSource;
   12.56 -    }
   12.57 -
   12.58 -    public String formatMessage(JCDiagnostic d, Locale l) {
   12.59 -        //this code should rely on the locale settings but it's not! See RFE 6443132
   12.60 -        StringBuilder buf = new StringBuilder();
   12.61 -        Collection<String> args = formatArguments(d, l);
   12.62 -        buf.append(localize(l, d.getCode(), args.toArray()));
   12.63 -        if (d.isMultiline()) {
   12.64 -            buf.append(formatSubdiagnostics(d, l));
   12.65 -        }
   12.66 -        return buf.toString();
   12.67 +        this.config = config;
   12.68      }
   12.69  
   12.70      public String formatKind(JCDiagnostic d, Locale l) {
   12.71 @@ -96,8 +87,8 @@
   12.72          assert (d.getPosition() != Position.NOPOS);
   12.73          return String.valueOf(getPosition(d, pk));
   12.74      }
   12.75 -    //WHERE
   12.76 -    public long getPosition(JCDiagnostic d, PositionKind pk) {
   12.77 +    //where
   12.78 +    private long getPosition(JCDiagnostic d, PositionKind pk) {
   12.79          switch (pk) {
   12.80              case START: return d.getIntStartPosition();
   12.81              case END: return d.getIntEndPosition();
   12.82 @@ -138,8 +129,17 @@
   12.83       * @return string representation of the diagnostic argument
   12.84       */
   12.85      protected String formatArgument(JCDiagnostic d, Object arg, Locale l) {
   12.86 -        if (arg instanceof JCDiagnostic)
   12.87 -            return format((JCDiagnostic)arg, l);
   12.88 +        if (arg instanceof JCDiagnostic) {
   12.89 +            String s = null;
   12.90 +            depth++;
   12.91 +            try {
   12.92 +                s = formatMessage((JCDiagnostic)arg, l);
   12.93 +            }
   12.94 +            finally {
   12.95 +                depth--;
   12.96 +            }
   12.97 +            return s;
   12.98 +        }
   12.99          else if (arg instanceof Iterable<?>) {
  12.100              return formatIterable(d, (Iterable<?>)arg, l);
  12.101          }
  12.102 @@ -171,45 +171,74 @@
  12.103      }
  12.104  
  12.105      /**
  12.106 -     * Format all the subdiagnostics attached to a given diagnostic
  12.107 +     * Format all the subdiagnostics attached to a given diagnostic.
  12.108       *
  12.109       * @param d diagnostic whose subdiagnostics are to be formatted
  12.110       * @param l locale object to be used for i18n
  12.111 +     * @return list of all string representations of the subdiagnostics
  12.112 +     */
  12.113 +    protected List<String> formatSubdiagnostics(JCDiagnostic d, Locale l) {
  12.114 +        List<String> subdiagnostics = List.nil();
  12.115 +        int maxDepth = config.getMultilineLimit(MultilineLimit.DEPTH);
  12.116 +        if (maxDepth == -1 || depth < maxDepth) {
  12.117 +            depth++;
  12.118 +            try {
  12.119 +                int maxCount = config.getMultilineLimit(MultilineLimit.LENGTH);
  12.120 +                int count = 0;
  12.121 +                for (JCDiagnostic d2 : d.getSubdiagnostics()) {
  12.122 +                    if (maxCount == -1 || count < maxCount) {
  12.123 +                        subdiagnostics = subdiagnostics.append(formatSubdiagnostic(d, d2, l));
  12.124 +                        count++;
  12.125 +                    }
  12.126 +                    else
  12.127 +                        break;
  12.128 +                }
  12.129 +            }
  12.130 +            finally {
  12.131 +                depth--;
  12.132 +            }
  12.133 +        }
  12.134 +        return subdiagnostics;
  12.135 +    }
  12.136 +
  12.137 +    /**
  12.138 +     * Format a subdiagnostics attached to a given diagnostic.
  12.139 +     *
  12.140 +     * @param parent multiline diagnostic whose subdiagnostics is to be formatted
  12.141 +     * @param sub subdiagnostic to be formatted
  12.142 +     * @param l locale object to be used for i18n
  12.143       * @return string representation of the subdiagnostics
  12.144       */
  12.145 -    protected String formatSubdiagnostics(JCDiagnostic d, Locale l) {
  12.146 -        StringBuilder buf = new StringBuilder();
  12.147 -        for (JCDiagnostic d2 : d.getSubdiagnostics()) {
  12.148 -            buf.append('\n');
  12.149 -            String subdiagMsg = format(d2, l);
  12.150 -            buf.append(indent(subdiagMsg, DiagInc));
  12.151 -        }
  12.152 -        return buf.toString();
  12.153 +    protected String formatSubdiagnostic(JCDiagnostic parent, JCDiagnostic sub, Locale l) {
  12.154 +        return formatMessage(sub, l);
  12.155      }
  12.156  
  12.157      /** Format the faulty source code line and point to the error.
  12.158       *  @param d The diagnostic for which the error line should be printed
  12.159       */
  12.160 -    protected String formatSourceLine(JCDiagnostic d) {
  12.161 +    protected String formatSourceLine(JCDiagnostic d, int nSpaces) {
  12.162          StringBuilder buf = new StringBuilder();
  12.163          DiagnosticSource source = d.getDiagnosticSource();
  12.164          int pos = d.getIntPosition();
  12.165 -        if (d.getIntPosition() != Position.NOPOS) {
  12.166 -            String line = (source == null ? null : source.getLine(pos));
  12.167 -            if (line == null)
  12.168 -                return "";
  12.169 -            buf.append(line+"\n");
  12.170 -            int col = source.getColumnNumber(pos, false);
  12.171 +        if (d.getIntPosition() == Position.NOPOS)
  12.172 +            throw new AssertionError();
  12.173 +        String line = (source == null ? null : source.getLine(pos));
  12.174 +        if (line == null)
  12.175 +            return "";
  12.176 +        buf.append(indent(line, nSpaces));
  12.177 +        int col = source.getColumnNumber(pos, false);
  12.178 +        if (config.isCaretEnabled()) {
  12.179 +            buf.append("\n");
  12.180              for (int i = 0; i < col - 1; i++)  {
  12.181                  buf.append((line.charAt(i) == '\t') ? "\t" : " ");
  12.182              }
  12.183 -            buf.append("^");
  12.184 -         }
  12.185 -         return buf.toString();
  12.186 +            buf.append(indent("^", nSpaces));
  12.187 +        }
  12.188 +        return buf.toString();
  12.189      }
  12.190  
  12.191      /**
  12.192 -     * Converts a String into a locale-dependent representation accordingly to a given locale
  12.193 +     * Converts a String into a locale-dependent representation accordingly to a given locale.
  12.194       *
  12.195       * @param l locale object to be used for i18n
  12.196       * @param key locale-independent key used for looking up in a resource file
  12.197 @@ -221,7 +250,9 @@
  12.198      }
  12.199  
  12.200      public boolean displaySource(JCDiagnostic d) {
  12.201 -        return showSource && d.getType() != FRAGMENT;
  12.202 +        return config.getVisible().contains(DiagnosticPart.SOURCE) &&
  12.203 +                d.getType() != FRAGMENT &&
  12.204 +                d.getIntPosition() != Position.NOPOS;
  12.205      }
  12.206  
  12.207      /**
  12.208 @@ -245,7 +276,7 @@
  12.209  
  12.210      /**
  12.211       * Indent a string by prepending a given amount of empty spaces to each line
  12.212 -     * of the string
  12.213 +     * of the string.
  12.214       *
  12.215       * @param s the string to be indented
  12.216       * @param nSpaces the amount of spaces that should be prepended to each line
  12.217 @@ -263,4 +294,114 @@
  12.218          }
  12.219          return buf.toString();
  12.220      }
  12.221 +
  12.222 +    public SimpleConfiguration getConfiguration() {
  12.223 +        return config;
  12.224 +    }
  12.225 +
  12.226 +    static public class SimpleConfiguration implements Configuration {
  12.227 +
  12.228 +        protected Map<MultilineLimit, Integer> multilineLimits;
  12.229 +        protected EnumSet<DiagnosticPart> visibleParts;
  12.230 +        protected boolean caretEnabled;
  12.231 +
  12.232 +        public SimpleConfiguration(Set<DiagnosticPart> parts) {
  12.233 +            multilineLimits = new HashMap<MultilineLimit, Integer>();
  12.234 +            setVisible(parts);
  12.235 +            setMultilineLimit(MultilineLimit.DEPTH, -1);
  12.236 +            setMultilineLimit(MultilineLimit.LENGTH, -1);
  12.237 +            setCaretEnabled(true);
  12.238 +        }
  12.239 +
  12.240 +        @SuppressWarnings("fallthrough")
  12.241 +        public SimpleConfiguration(Options options, Set<DiagnosticPart> parts) {
  12.242 +            this(parts);
  12.243 +            String showSource = null;
  12.244 +            if ((showSource = options.get("showSource")) != null) {
  12.245 +                if (showSource.equals("true"))
  12.246 +                    visibleParts.add(DiagnosticPart.SOURCE);
  12.247 +                else if (showSource.equals("false"))
  12.248 +                    visibleParts.remove(DiagnosticPart.SOURCE);
  12.249 +            }
  12.250 +            String diagOpts = options.get("diags");
  12.251 +            if (diagOpts != null) {//override -XDshowSource
  12.252 +                Collection<String> args = Arrays.asList(diagOpts.split(","));
  12.253 +                if (args.contains("short")) {
  12.254 +                    visibleParts.remove(DiagnosticPart.DETAILS);
  12.255 +                    visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
  12.256 +                }
  12.257 +                if (args.contains("source"))
  12.258 +                    visibleParts.add(DiagnosticPart.SOURCE);
  12.259 +                if (args.contains("-source"))
  12.260 +                    visibleParts.remove(DiagnosticPart.SOURCE);
  12.261 +            }
  12.262 +            String multiPolicy = null;
  12.263 +            if ((multiPolicy = options.get("multilinePolicy")) != null) {
  12.264 +                if (multiPolicy.equals("disabled"))
  12.265 +                    visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
  12.266 +                else if (multiPolicy.startsWith("limit:")) {
  12.267 +                    String limitString = multiPolicy.substring("limit:".length());
  12.268 +                    String[] limits = limitString.split(":");
  12.269 +                    try {
  12.270 +                        switch (limits.length) {
  12.271 +                            case 2: {
  12.272 +                                if (!limits[1].equals("*"))
  12.273 +                                    setMultilineLimit(MultilineLimit.DEPTH, Integer.parseInt(limits[1]));
  12.274 +                            }
  12.275 +                            case 1: {
  12.276 +                                if (!limits[0].equals("*"))
  12.277 +                                    setMultilineLimit(MultilineLimit.LENGTH, Integer.parseInt(limits[0]));
  12.278 +                            }
  12.279 +                        }
  12.280 +                    }
  12.281 +                    catch(NumberFormatException ex) {
  12.282 +                        setMultilineLimit(MultilineLimit.DEPTH, -1);
  12.283 +                        setMultilineLimit(MultilineLimit.LENGTH, -1);
  12.284 +                    }
  12.285 +                }
  12.286 +            }
  12.287 +            String showCaret = null;
  12.288 +            if (((showCaret = options.get("showCaret")) != null) &&
  12.289 +                showCaret.equals("false"))
  12.290 +                    setCaretEnabled(false);
  12.291 +            else
  12.292 +                setCaretEnabled(true);
  12.293 +        }
  12.294 +
  12.295 +        public int getMultilineLimit(MultilineLimit limit) {
  12.296 +            return multilineLimits.get(limit);
  12.297 +        }
  12.298 +
  12.299 +        public EnumSet<DiagnosticPart> getVisible() {
  12.300 +            return EnumSet.copyOf(visibleParts);
  12.301 +        }
  12.302 +
  12.303 +        public void setMultilineLimit(MultilineLimit limit, int value) {
  12.304 +            multilineLimits.put(limit, value < -1 ? -1 : value);
  12.305 +        }
  12.306 +
  12.307 +
  12.308 +        public void setVisible(Set<DiagnosticPart> diagParts) {
  12.309 +            visibleParts = EnumSet.copyOf(diagParts);
  12.310 +        }
  12.311 +
  12.312 +        /**
  12.313 +         * Shows a '^' sign under the source line displayed by the formatter
  12.314 +         * (if applicable).
  12.315 +         *
  12.316 +         * @param caretEnabled if true enables caret
  12.317 +         */
  12.318 +        public void setCaretEnabled(boolean caretEnabled) {
  12.319 +            this.caretEnabled = caretEnabled;
  12.320 +        }
  12.321 +
  12.322 +        /**
  12.323 +         * Tells whether the caret display is active or not.
  12.324 +         *
  12.325 +         * @param caretEnabled if true the caret is enabled
  12.326 +         */
  12.327 +        public boolean isCaretEnabled() {
  12.328 +            return caretEnabled;
  12.329 +        }
  12.330 +    }
  12.331  }
    13.1 --- a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Tue Feb 17 09:07:14 2009 -0800
    13.2 +++ b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Thu Feb 19 18:04:54 2009 -0800
    13.3 @@ -25,13 +25,20 @@
    13.4  
    13.5  package com.sun.tools.javac.util;
    13.6  
    13.7 +import java.util.Collection;
    13.8 +import java.util.EnumSet;
    13.9  import java.util.HashMap;
   13.10  import java.util.Locale;
   13.11  import java.util.Map;
   13.12 +import java.util.regex.Matcher;
   13.13  import javax.tools.JavaFileObject;
   13.14  
   13.15 -import static com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicFormatKind.*;
   13.16 +import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
   13.17 +import com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration;
   13.18 +
   13.19  import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
   13.20 +import static com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration.*;
   13.21 +import static com.sun.tools.javac.util.LayoutCharacters.*;
   13.22  
   13.23  /**
   13.24   * A basic formatter for diagnostic messages.
   13.25 @@ -53,7 +60,7 @@
   13.26   */
   13.27  public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
   13.28  
   13.29 -    protected Map<BasicFormatKind, String> availableFormats;
   13.30 +    protected int currentIndentation = 0;
   13.31  
   13.32      /**
   13.33       * Create a basic formatter based on the supplied options.
   13.34 @@ -62,21 +69,8 @@
   13.35       * @param msgs JavacMessages object used for i18n
   13.36       */
   13.37      @SuppressWarnings("fallthrough")
   13.38 -    BasicDiagnosticFormatter(Options opts, JavacMessages msgs) {
   13.39 -        super(msgs, opts, true);
   13.40 -        initAvailableFormats();
   13.41 -        String fmt = opts.get("diags");
   13.42 -        if (fmt != null) {
   13.43 -            String[] formats = fmt.split("\\|");
   13.44 -            switch (formats.length) {
   13.45 -                case 3:
   13.46 -                    availableFormats.put(DEFAULT_CLASS_FORMAT, formats[2]);
   13.47 -                case 2:
   13.48 -                    availableFormats.put(DEFAULT_NO_POS_FORMAT, formats[1]);
   13.49 -                default:
   13.50 -                    availableFormats.put(DEFAULT_POS_FORMAT, formats[0]);
   13.51 -            }
   13.52 -        }
   13.53 +    public BasicDiagnosticFormatter(Options options, JavacMessages msgs) {
   13.54 +        super(msgs, new BasicConfiguration(options));
   13.55      }
   13.56  
   13.57      /**
   13.58 @@ -85,15 +79,7 @@
   13.59       * @param msgs JavacMessages object used for i18n
   13.60       */
   13.61      public BasicDiagnosticFormatter(JavacMessages msgs) {
   13.62 -        super(msgs, true);
   13.63 -        initAvailableFormats();
   13.64 -    }
   13.65 -
   13.66 -    public void initAvailableFormats() {
   13.67 -        availableFormats = new HashMap<BasicFormatKind, String>();
   13.68 -        availableFormats.put(DEFAULT_POS_FORMAT, "%f:%l:%_%t%m");
   13.69 -        availableFormats.put(DEFAULT_NO_POS_FORMAT, "%p%m");
   13.70 -        availableFormats.put(DEFAULT_CLASS_FORMAT, "%f:%_%t%m");
   13.71 +        super(msgs, new BasicConfiguration());
   13.72      }
   13.73  
   13.74      public String format(JCDiagnostic d, Locale l) {
   13.75 @@ -110,10 +96,55 @@
   13.76              }
   13.77              buf.append(meta ? formatMeta(c, d, l) : String.valueOf(c));
   13.78          }
   13.79 -        if (displaySource(d)) {
   13.80 -            buf.append("\n" + formatSourceLine(d));
   13.81 +        if (depth == 0)
   13.82 +            return addSourceLineIfNeeded(d, buf.toString());
   13.83 +        else
   13.84 +            return buf.toString();
   13.85 +    }
   13.86 +
   13.87 +    public String formatMessage(JCDiagnostic d, Locale l) {
   13.88 +        int prevIndentation = currentIndentation;
   13.89 +        try {
   13.90 +            StringBuilder buf = new StringBuilder();
   13.91 +            Collection<String> args = formatArguments(d, l);
   13.92 +            String msg = localize(l, d.getCode(), args.toArray());
   13.93 +            String[] lines = msg.split("\n");
   13.94 +            if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) {
   13.95 +                currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY);
   13.96 +                buf.append(indent(lines[0], currentIndentation)); //summary
   13.97 +            }
   13.98 +            if (lines.length > 1 && getConfiguration().getVisible().contains(DiagnosticPart.DETAILS)) {
   13.99 +                currentIndentation += getConfiguration().getIndentation(DiagnosticPart.DETAILS);
  13.100 +                for (int i = 1;i < lines.length; i++) {
  13.101 +                    buf.append("\n" + indent(lines[i], currentIndentation));
  13.102 +                }
  13.103 +            }
  13.104 +            if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) {
  13.105 +                currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS);
  13.106 +                for (String sub : formatSubdiagnostics(d, l)) {
  13.107 +                    buf.append("\n" + sub);
  13.108 +                }
  13.109 +            }
  13.110 +            return buf.toString();
  13.111          }
  13.112 -        return buf.toString();
  13.113 +        finally {
  13.114 +            currentIndentation = prevIndentation;
  13.115 +        }
  13.116 +    }
  13.117 +
  13.118 +    protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
  13.119 +        if (!displaySource(d))
  13.120 +            return msg;
  13.121 +        else {
  13.122 +            BasicConfiguration conf = getConfiguration();
  13.123 +            int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
  13.124 +            String sourceLine = "\n" + formatSourceLine(d, indentSource);
  13.125 +            boolean singleLine = msg.indexOf("\n") == -1;
  13.126 +            if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
  13.127 +                return msg + sourceLine;
  13.128 +            else
  13.129 +                return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
  13.130 +        }
  13.131      }
  13.132  
  13.133      protected String formatMeta(char c, JCDiagnostic d, Locale l) {
  13.134 @@ -164,34 +195,199 @@
  13.135  
  13.136      private String selectFormat(JCDiagnostic d) {
  13.137          DiagnosticSource source = d.getDiagnosticSource();
  13.138 -        String format = availableFormats.get(DEFAULT_NO_POS_FORMAT);
  13.139 +        String format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT);
  13.140          if (source != null) {
  13.141              if (d.getIntPosition() != Position.NOPOS) {
  13.142 -                format = availableFormats.get(DEFAULT_POS_FORMAT);
  13.143 +                format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_POS_FORMAT);
  13.144              } else if (source.getFile() != null &&
  13.145                         source.getFile().getKind() == JavaFileObject.Kind.CLASS) {
  13.146 -                format = availableFormats.get(DEFAULT_CLASS_FORMAT);
  13.147 +                format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT);
  13.148              }
  13.149          }
  13.150          return format;
  13.151      }
  13.152  
  13.153 -    /**
  13.154 -     * This enum contains all the kinds of formatting patterns supported
  13.155 -     * by a basic diagnostic formatter.
  13.156 -     */
  13.157 -    public enum BasicFormatKind {
  13.158 +    @Override
  13.159 +    public BasicConfiguration getConfiguration() {
  13.160 +        return (BasicConfiguration)super.getConfiguration();
  13.161 +    }
  13.162 +
  13.163 +    static public class BasicConfiguration extends SimpleConfiguration {
  13.164 +
  13.165 +        protected Map<DiagnosticPart, Integer> indentationLevels;
  13.166 +        protected Map<BasicFormatKind, String> availableFormats;
  13.167 +        protected SourcePosition sourcePosition;
  13.168 +
  13.169 +        @SuppressWarnings("fallthrough")
  13.170 +        public BasicConfiguration(Options options) {
  13.171 +            super(options, EnumSet.of(DiagnosticPart.SUMMARY,
  13.172 +                            DiagnosticPart.DETAILS,
  13.173 +                            DiagnosticPart.SUBDIAGNOSTICS,
  13.174 +                            DiagnosticPart.SOURCE));
  13.175 +            initFormat();
  13.176 +            initIndentation();
  13.177 +            String fmt = options.get("diagsFormat");
  13.178 +            if (fmt != null) {
  13.179 +                String[] formats = fmt.split("\\|");
  13.180 +                switch (formats.length) {
  13.181 +                    case 3:
  13.182 +                        setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, formats[2]);
  13.183 +                    case 2:
  13.184 +                        setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, formats[1]);
  13.185 +                    default:
  13.186 +                        setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, formats[0]);
  13.187 +                }
  13.188 +            }
  13.189 +            String sourcePosition = null;
  13.190 +            if ((((sourcePosition = options.get("sourcePosition")) != null)) &&
  13.191 +                    sourcePosition.equals("bottom"))
  13.192 +                    setSourcePosition(SourcePosition.BOTTOM);
  13.193 +            else
  13.194 +                setSourcePosition(SourcePosition.AFTER_SUMMARY);
  13.195 +            String indent = options.get("diagsIndentation");
  13.196 +            if (indent != null) {
  13.197 +                String[] levels = indent.split("\\|");
  13.198 +                try {
  13.199 +                    switch (levels.length) {
  13.200 +                        case 5:
  13.201 +                            setIndentation(DiagnosticPart.JLS,
  13.202 +                                    Integer.parseInt(levels[4]));
  13.203 +                        case 4:
  13.204 +                            setIndentation(DiagnosticPart.SUBDIAGNOSTICS,
  13.205 +                                    Integer.parseInt(levels[3]));
  13.206 +                        case 3:
  13.207 +                            setIndentation(DiagnosticPart.SOURCE,
  13.208 +                                    Integer.parseInt(levels[2]));
  13.209 +                        case 2:
  13.210 +                            setIndentation(DiagnosticPart.DETAILS,
  13.211 +                                    Integer.parseInt(levels[1]));
  13.212 +                        default:
  13.213 +                            setIndentation(DiagnosticPart.SUMMARY,
  13.214 +                                    Integer.parseInt(levels[0]));
  13.215 +                    }
  13.216 +                }
  13.217 +                catch (NumberFormatException ex) {
  13.218 +                    initIndentation();
  13.219 +                }
  13.220 +            }
  13.221 +        }
  13.222 +
  13.223 +        public BasicConfiguration() {
  13.224 +            super(EnumSet.of(DiagnosticPart.SUMMARY,
  13.225 +                  DiagnosticPart.DETAILS,
  13.226 +                  DiagnosticPart.SUBDIAGNOSTICS,
  13.227 +                  DiagnosticPart.SOURCE));
  13.228 +            initFormat();
  13.229 +            initIndentation();
  13.230 +        }
  13.231 +        //where
  13.232 +        private void initFormat() {
  13.233 +            availableFormats = new HashMap<BasicFormatKind, String>();
  13.234 +            setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, "%f:%l:%_%t%m");
  13.235 +            setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, "%p%m");
  13.236 +            setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, "%f:%_%t%m");
  13.237 +        }
  13.238 +        //where
  13.239 +        private void initIndentation() {
  13.240 +            indentationLevels = new HashMap<DiagnosticPart, Integer>();
  13.241 +            setIndentation(DiagnosticPart.SUMMARY, 0);
  13.242 +            setIndentation(DiagnosticPart.DETAILS, DetailsInc);
  13.243 +            setIndentation(DiagnosticPart.SUBDIAGNOSTICS, DiagInc);
  13.244 +            setIndentation(DiagnosticPart.SOURCE, 0);
  13.245 +        }
  13.246 +
  13.247          /**
  13.248 -        * A format string to be used for diagnostics with a given position.
  13.249 -        */
  13.250 -        DEFAULT_POS_FORMAT,
  13.251 +         * Get the amount of spaces for a given indentation kind
  13.252 +         * @param diagPart the diagnostic part for which the indentation is
  13.253 +         * to be retrieved
  13.254 +         * @return the amount of spaces used for the specified indentation kind
  13.255 +         */
  13.256 +        public int getIndentation(DiagnosticPart diagPart) {
  13.257 +            return indentationLevels.get(diagPart);
  13.258 +        }
  13.259 +
  13.260          /**
  13.261 -        * A format string to be used for diagnostics without a given position.
  13.262 -        */
  13.263 -        DEFAULT_NO_POS_FORMAT,
  13.264 +         * Set the indentation level for various element of a given diagnostic -
  13.265 +         * this might lead to more readable diagnostics
  13.266 +         *
  13.267 +         * @param indentationKind kind of indentation to be set
  13.268 +         * @param nSpaces amount of spaces for the specified diagnostic part
  13.269 +         */
  13.270 +        public void setIndentation(DiagnosticPart diagPart, int nSpaces) {
  13.271 +            indentationLevels.put(diagPart, nSpaces);
  13.272 +        }
  13.273 +
  13.274          /**
  13.275 -        * A format string to be used for diagnostics regarding classfiles
  13.276 -        */
  13.277 -        DEFAULT_CLASS_FORMAT;
  13.278 +         * Set the source line positioning used by this formatter
  13.279 +         *
  13.280 +         * @param sourcePos a positioning value for source line
  13.281 +         */
  13.282 +        public void setSourcePosition(SourcePosition sourcePos) {
  13.283 +            sourcePosition = sourcePos;
  13.284 +        }
  13.285 +
  13.286 +        /**
  13.287 +         * Get the source line positioning used by this formatter
  13.288 +         *
  13.289 +         * @return the positioning value used by this formatter
  13.290 +         */
  13.291 +        public SourcePosition getSourcePosition() {
  13.292 +            return sourcePosition;
  13.293 +        }
  13.294 +        //where
  13.295 +        /**
  13.296 +         * A source positioning value controls the position (within a given
  13.297 +         * diagnostic message) in which the source line the diagnostic refers to
  13.298 +         * should be displayed (if applicable)
  13.299 +         */
  13.300 +        public enum SourcePosition {
  13.301 +            /**
  13.302 +             * Source line is displayed after the diagnostic message
  13.303 +             */
  13.304 +            BOTTOM,
  13.305 +            /**
  13.306 +             * Source line is displayed after the first line of the diagnostic
  13.307 +             * message
  13.308 +             */
  13.309 +            AFTER_SUMMARY;
  13.310 +        }
  13.311 +
  13.312 +        /**
  13.313 +         * Set a metachar string for a specific format
  13.314 +         *
  13.315 +         * @param kind the format kind to be set
  13.316 +         * @param s the metachar string specifying the format
  13.317 +         */
  13.318 +        public void setFormat(BasicFormatKind kind, String s) {
  13.319 +            availableFormats.put(kind, s);
  13.320 +        }
  13.321 +
  13.322 +        /**
  13.323 +         * Get a metachar string for a specific format
  13.324 +         *
  13.325 +         * @param sourcePos a positioning value for source line
  13.326 +         */
  13.327 +        public String getFormat(BasicFormatKind kind) {
  13.328 +            return availableFormats.get(kind);
  13.329 +        }
  13.330 +        //where
  13.331 +        /**
  13.332 +         * This enum contains all the kinds of formatting patterns supported
  13.333 +         * by a basic diagnostic formatter.
  13.334 +         */
  13.335 +        public enum BasicFormatKind {
  13.336 +            /**
  13.337 +            * A format string to be used for diagnostics with a given position.
  13.338 +            */
  13.339 +            DEFAULT_POS_FORMAT,
  13.340 +            /**
  13.341 +            * A format string to be used for diagnostics without a given position.
  13.342 +            */
  13.343 +            DEFAULT_NO_POS_FORMAT,
  13.344 +            /**
  13.345 +            * A format string to be used for diagnostics regarding classfiles
  13.346 +            */
  13.347 +            DEFAULT_CLASS_FORMAT;
  13.348 +        }
  13.349      }
  13.350  }
    14.1 --- a/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java	Tue Feb 17 09:07:14 2009 -0800
    14.2 +++ b/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java	Thu Feb 19 18:04:54 2009 -0800
    14.3 @@ -39,9 +39,13 @@
    14.4       */
    14.5      final static int TabInc = 8;
    14.6  
    14.7 -    /** Diagnostic standard indentation
    14.8 +    /** Standard indentation for subdiagnostics
    14.9       */
   14.10 -    final static int DiagInc = 2;
   14.11 +    final static int DiagInc = 4;
   14.12 +
   14.13 +    /** Standard indentation for additional diagnostic lines
   14.14 +     */
   14.15 +    final static int DetailsInc = 2;
   14.16  
   14.17      /** Tabulator character.
   14.18       */
    15.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java	Tue Feb 17 09:07:14 2009 -0800
    15.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Feb 19 18:04:54 2009 -0800
    15.3 @@ -93,17 +93,17 @@
    15.4      protected DiagnosticListener<? super JavaFileObject> diagListener;
    15.5  
    15.6      /**
    15.7 -     * Formatter for diagnostics
    15.8 +     * Formatter for diagnostics.
    15.9       */
   15.10      private DiagnosticFormatter<JCDiagnostic> diagFormatter;
   15.11  
   15.12      /**
   15.13 -     * Keys for expected diagnostics
   15.14 +     * Keys for expected diagnostics.
   15.15       */
   15.16      public Set<String> expectDiagKeys;
   15.17  
   15.18      /**
   15.19 -     * JavacMessages object used for localization
   15.20 +     * JavacMessages object used for localization.
   15.21       */
   15.22      private JavacMessages messages;
   15.23  
   15.24 @@ -206,6 +206,18 @@
   15.25          return source == null ? null : source.getFile();
   15.26      }
   15.27  
   15.28 +    /** Get the current diagnostic formatter.
   15.29 +     */
   15.30 +    public DiagnosticFormatter<JCDiagnostic> getDiagnosticFormatter() {
   15.31 +        return diagFormatter;
   15.32 +    }
   15.33 +
   15.34 +    /** Set the current diagnostic formatter.
   15.35 +     */
   15.36 +    public void setDiagnosticFormatter(DiagnosticFormatter<JCDiagnostic> diagFormatter) {
   15.37 +        this.diagFormatter = diagFormatter;
   15.38 +    }
   15.39 +
   15.40      /** Flush the logs
   15.41       */
   15.42      public void flush() {
    16.1 --- a/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java	Tue Feb 17 09:07:14 2009 -0800
    16.2 +++ b/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java	Thu Feb 19 18:04:54 2009 -0800
    16.3 @@ -24,9 +24,14 @@
    16.4   */
    16.5  package com.sun.tools.javac.util;
    16.6  
    16.7 +import java.util.Collection;
    16.8 +import java.util.EnumSet;
    16.9  import java.util.Locale;
   16.10  
   16.11 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.*;
   16.12  import com.sun.tools.javac.api.Formattable;
   16.13 +import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
   16.14 +
   16.15  import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
   16.16  
   16.17  /**
   16.18 @@ -35,14 +40,17 @@
   16.19   * or not the source name and position are set. This formatter provides a standardized, localize-independent
   16.20   * implementation of a diagnostic formatter; as such, this formatter is best suited for testing purposes.
   16.21   */
   16.22 -public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
   16.23 +public final class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
   16.24  
   16.25      /**
   16.26       * Create a formatter based on the supplied options.
   16.27       * @param msgs
   16.28       */
   16.29 -    public RawDiagnosticFormatter(Options opts) {
   16.30 -        super(null, opts, false);
   16.31 +    public RawDiagnosticFormatter(Options options) {
   16.32 +        super(null, new SimpleConfiguration(options,
   16.33 +                EnumSet.of(DiagnosticPart.SUMMARY,
   16.34 +                        DiagnosticPart.DETAILS,
   16.35 +                        DiagnosticPart.SUBDIAGNOSTICS)));
   16.36      }
   16.37  
   16.38      //provide common default formats
   16.39 @@ -62,7 +70,7 @@
   16.40              buf.append(' ');
   16.41              buf.append(formatMessage(d, null));
   16.42              if (displaySource(d))
   16.43 -                buf.append("\n" + formatSourceLine(d));
   16.44 +                buf.append("\n" + formatSourceLine(d, 0));
   16.45              return buf.toString();
   16.46          }
   16.47          catch (Exception e) {
   16.48 @@ -71,6 +79,32 @@
   16.49          }
   16.50      }
   16.51  
   16.52 +    public String formatMessage(JCDiagnostic d, Locale l) {
   16.53 +        StringBuilder buf = new StringBuilder();
   16.54 +        Collection<String> args = formatArguments(d, l);
   16.55 +        buf.append(d.getCode());
   16.56 +        String sep = ": ";
   16.57 +        for (Object o : args) {
   16.58 +            buf.append(sep);
   16.59 +            buf.append(o);
   16.60 +            sep = ", ";
   16.61 +        }
   16.62 +        if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) {
   16.63 +            List<String> subDiags = formatSubdiagnostics(d, null);
   16.64 +            if (subDiags.nonEmpty()) {
   16.65 +                sep = "";
   16.66 +                buf.append(",{");
   16.67 +                for (String sub : formatSubdiagnostics(d, null)) {
   16.68 +                    buf.append(sep);
   16.69 +                    buf.append("(" + sub + ")");
   16.70 +                    sep = ",";
   16.71 +                }
   16.72 +                buf.append('}');
   16.73 +            }
   16.74 +        }
   16.75 +        return buf.toString();
   16.76 +    }
   16.77 +
   16.78      @Override
   16.79      protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
   16.80          String s;
   16.81 @@ -83,31 +117,4 @@
   16.82          else
   16.83              return s;
   16.84      }
   16.85 -
   16.86 -    @Override
   16.87 -    protected String formatSubdiagnostics(JCDiagnostic d, Locale l) {
   16.88 -        StringBuilder buf = new StringBuilder();
   16.89 -        String sep = "";
   16.90 -        buf.append(",{");
   16.91 -        for (JCDiagnostic d2 : d.getSubdiagnostics()) {
   16.92 -            buf.append(sep);
   16.93 -            buf.append("(" + format(d2, l) + ")");
   16.94 -            sep = ",";
   16.95 -        }
   16.96 -        buf.append('}');
   16.97 -        return buf.toString();
   16.98 -    }
   16.99 -
  16.100 -    @Override
  16.101 -    protected String localize(Locale l, String s, Object... args) {
  16.102 -        StringBuffer buf = new StringBuffer();
  16.103 -        buf.append(s);
  16.104 -        String sep = ": ";
  16.105 -        for (Object o : args) {
  16.106 -            buf.append(sep);
  16.107 -            buf.append(o);
  16.108 -            sep = ", ";
  16.109 -        }
  16.110 -        return buf.toString();
  16.111 -    }
  16.112  }
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java	Thu Feb 19 18:04:54 2009 -0800
    17.3 @@ -0,0 +1,151 @@
    17.4 +/*
    17.5 + * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
    17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 + *
    17.8 + * This code is free software; you can redistribute it and/or modify it
    17.9 + * under the terms of the GNU General Public License version 2 only, as
   17.10 + * published by the Free Software Foundation.  Sun designates this
   17.11 + * particular file as subject to the "Classpath" exception as provided
   17.12 + * by Sun in the LICENSE file that accompanied this code.
   17.13 + *
   17.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   17.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.17 + * version 2 for more details (a copy is included in the LICENSE file that
   17.18 + * accompanied this code).
   17.19 + *
   17.20 + * You should have received a copy of the GNU General Public License version
   17.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   17.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.23 + *
   17.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   17.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
   17.26 + * have any questions.
   17.27 + */
   17.28 +
   17.29 +/*
   17.30 + * @test
   17.31 + * @bug 6802694
   17.32 + * @summary This test verifies deprecation info in serialized-form.html.
   17.33 + * @author Bhavesh Patel
   17.34 + * @library ../lib/
   17.35 + * @build JavadocTester
   17.36 + * @build TestSerializedFormDeprecationInfo
   17.37 + * @run main TestSerializedFormDeprecationInfo
   17.38 + */
   17.39 +
   17.40 +public class TestSerializedFormDeprecationInfo extends JavadocTester {
   17.41 +
   17.42 +    private static final String BUG_ID = "6802694";
   17.43 +
   17.44 +    // Test for normal run of javadoc. The serialized-form.html should
   17.45 +    // display the inline comments, tags and deprecation information if any.
   17.46 +    private static final String[][] TEST_CMNT_DEPR = {
   17.47 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL + NL +
   17.48 +                 "<DT><STRONG>Throws:</STRONG>" + NL + "<DD><CODE>" +
   17.49 +                 "java.io.IOException</CODE><DT><STRONG>See Also:</STRONG>" +
   17.50 +                 "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
   17.51 +                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD>" + NL +
   17.52 +                 "</DL>" + NL + "</DL>"},
   17.53 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
   17.54 +                 "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
   17.55 +                 " 1.5, replaced by" + NL +
   17.56 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
   17.57 +                 "<CODE>setUndecorated(boolean)</CODE></A>.</I>" +
   17.58 +                 "<DD>This field indicates whether the C1 is undecorated." + NL +
   17.59 +                 "<P>" + NL + "<DT><DD>&nbsp;<DL>" + NL +
   17.60 +                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
   17.61 +                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
   17.62 +                 "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
   17.63 +                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DL>" + NL +
   17.64 +                 "</DL>"},
   17.65 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
   17.66 +                 "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
   17.67 +                 " 1.5, replaced by" + NL +
   17.68 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
   17.69 +                 "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
   17.70 +                 "<DD>Reads the object stream." + NL + "<P>" + NL +
   17.71 +                 "<DD><DL>" + NL + NL + "<DT><STRONG>Throws:" +
   17.72 +                 "</STRONG>" + NL + "<DD><CODE><code>" +
   17.73 +                 "IOException</code></CODE>" + NL +
   17.74 +                 "<DD><CODE>java.io.IOException</CODE></DD>" + NL +
   17.75 +                 "</DL>" + NL + "</DL>"},
   17.76 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
   17.77 +                 "<DD><STRONG>Deprecated.</STRONG>&nbsp;<DD>" +
   17.78 +                 "The name for this class." + NL + "<P>" + NL +
   17.79 +                 "<DT><DD>&nbsp;<DL>" + NL + "</DL>" + NL + "</DL>"}};
   17.80 +
   17.81 +    // Test with -nocomment option. The serialized-form.html should
   17.82 +    // not display the inline comments and tags but should display deprecation
   17.83 +    // information if any.
   17.84 +    private static final String[][] TEST_NOCMNT = {
   17.85 +        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "boolean <STRONG>" +
   17.86 +                 "undecorated</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
   17.87 +                 "Deprecated.</STRONG>&nbsp;<I>As of JDK version 1.5, replaced by" + NL +
   17.88 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
   17.89 +                 "setUndecorated(boolean)</CODE></A>.</I></DL>"},
   17.90 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
   17.91 +                 "Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
   17.92 +                 " 1.5, replaced by" + NL +
   17.93 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
   17.94 +                 "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
   17.95 +                 "</DL>"},
   17.96 +        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
   17.97 +                 "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
   17.98 +                 "Deprecated.</STRONG>&nbsp;</DL>"}};
   17.99 +
  17.100 +    // Test with -nodeprecated option. The serialized-form.html should
  17.101 +    // ignore the -nodeprecated tag and display the deprecation info. This
  17.102 +    // test is similar to the normal run of javadoc in which inline comment, tags
  17.103 +    // and deprecation information will be displayed.
  17.104 +    private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
  17.105 +
  17.106 +    // Test with -nodeprecated and -nocomment options. The serialized-form.html should
  17.107 +    // ignore the -nodeprecated tag and display the deprecation info but should not
  17.108 +    // display the inline comments and tags. This test is similar to the test with
  17.109 +    // -nocomment option.
  17.110 +    private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
  17.111 +
  17.112 +    private static final String[] ARGS1 =
  17.113 +        new String[] {
  17.114 +            "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
  17.115 +
  17.116 +    private static final String[] ARGS2 =
  17.117 +        new String[] {
  17.118 +            "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
  17.119 +
  17.120 +    private static final String[] ARGS3 =
  17.121 +        new String[] {
  17.122 +            "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
  17.123 +
  17.124 +    private static final String[] ARGS4 =
  17.125 +        new String[] {
  17.126 +            "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
  17.127 +
  17.128 +    /**
  17.129 +     * The entry point of the test.
  17.130 +     * @param args the array of command line arguments.
  17.131 +     */
  17.132 +    public static void main(String[] args) {
  17.133 +        TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
  17.134 +        run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
  17.135 +        run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
  17.136 +        run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
  17.137 +        run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
  17.138 +        tester.printSummary();
  17.139 +    }
  17.140 +
  17.141 +    /**
  17.142 +     * {@inheritDoc}
  17.143 +     */
  17.144 +    public String getBugId() {
  17.145 +        return BUG_ID;
  17.146 +    }
  17.147 +
  17.148 +    /**
  17.149 +     * {@inheritDoc}
  17.150 +     */
  17.151 +    public String getBugName() {
  17.152 +        return getClass().getName();
  17.153 +    }
  17.154 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C1.java	Thu Feb 19 18:04:54 2009 -0800
    18.3 @@ -0,0 +1,108 @@
    18.4 +/*
    18.5 + * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
    18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 + *
    18.8 + * This code is free software; you can redistribute it and/or modify it
    18.9 + * under the terms of the GNU General Public License version 2 only, as
   18.10 + * published by the Free Software Foundation.  Sun designates this
   18.11 + * particular file as subject to the "Classpath" exception as provided
   18.12 + * by Sun in the LICENSE file that accompanied this code.
   18.13 + *
   18.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   18.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.17 + * version 2 for more details (a copy is included in the LICENSE file that
   18.18 + * accompanied this code).
   18.19 + *
   18.20 + * You should have received a copy of the GNU General Public License version
   18.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   18.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.23 + *
   18.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   18.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
   18.26 + * have any questions.
   18.27 + */
   18.28 +
   18.29 +package pkg1;
   18.30 +
   18.31 +import java.io.IOException;
   18.32 +import java.io.Serializable;
   18.33 +
   18.34 +/**
   18.35 + * A class comment for testing.
   18.36 + *
   18.37 + * @author      Bhavesh Patel
   18.38 + * @see C2
   18.39 + * @since       JDK1.0
   18.40 + */
   18.41 +
   18.42 +public class C1 implements Serializable {
   18.43 +
   18.44 +    /**
   18.45 +     * This field indicates whether the C1 is undecorated.
   18.46 +     *
   18.47 +     * @see #setUndecorated(boolean)
   18.48 +     * @since 1.4
   18.49 +     * @serial
   18.50 +     * @deprecated As of JDK version 1.5, replaced by
   18.51 +     * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
   18.52 +     */
   18.53 +     @Deprecated
   18.54 +    public boolean undecorated = false;
   18.55 +
   18.56 +    private String title;
   18.57 +
   18.58 +    /**
   18.59 +     * This enum specifies the possible modal exclusion types.
   18.60 +     *
   18.61 +     * @since 1.6
   18.62 +     */
   18.63 +    public static enum ModalExclusionType {
   18.64 +        /**
   18.65 +         * No modal exclusion.
   18.66 +         */
   18.67 +        NO_EXCLUDE,
   18.68 +        /**
   18.69 +         * <code>APPLICATION_EXCLUDE</code> indicates that a top-level window
   18.70 +         * won't be blocked by any application-modal dialogs. Also, it isn't
   18.71 +         * blocked by document-modal dialogs from outside of its child hierarchy.
   18.72 +         */
   18.73 +        APPLICATION_EXCLUDE
   18.74 +    };
   18.75 +
   18.76 +    /**
   18.77 +     * Constructor.
   18.78 +     *
   18.79 +     * @param title the title
   18.80 +     * @param test boolean value
   18.81 +     * @exception IllegalArgumentException if the <code>owner</code>'s
   18.82 +     *     <code>GraphicsConfiguration</code> is not from a screen device
   18.83 +     * @exception HeadlessException
   18.84 +     */
   18.85 +     public C1(String title, boolean test) {
   18.86 +
   18.87 +     }
   18.88 +
   18.89 +     public C1(String title) {
   18.90 +
   18.91 +     }
   18.92 +
   18.93 +    /**
   18.94 +     * Method comments.
   18.95 +     * @param  undecorated <code>true</code> if no decorations are
   18.96 +     *         to be enabled;
   18.97 +     *         <code>false</code> if decorations are to be enabled.
   18.98 +     * @see    #readObject()
   18.99 +     * @since 1.4
  18.100 +     */
  18.101 +    public void setUndecorated(boolean undecorated) {
  18.102 +        /* Make sure we don't run in the middle of peer creation.*/
  18.103 +    }
  18.104 +
  18.105 +    /**
  18.106 +     * @see #setUndecorated(boolean)
  18.107 +     */
  18.108 +    public void readObject() throws IOException {
  18.109 +
  18.110 +    }
  18.111 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java	Thu Feb 19 18:04:54 2009 -0800
    19.3 @@ -0,0 +1,86 @@
    19.4 +/*
    19.5 + * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
    19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 + *
    19.8 + * This code is free software; you can redistribute it and/or modify it
    19.9 + * under the terms of the GNU General Public License version 2 only, as
   19.10 + * published by the Free Software Foundation.  Sun designates this
   19.11 + * particular file as subject to the "Classpath" exception as provided
   19.12 + * by Sun in the LICENSE file that accompanied this code.
   19.13 + *
   19.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   19.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.17 + * version 2 for more details (a copy is included in the LICENSE file that
   19.18 + * accompanied this code).
   19.19 + *
   19.20 + * You should have received a copy of the GNU General Public License version
   19.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   19.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.23 + *
   19.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   19.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
   19.26 + * have any questions.
   19.27 + */
   19.28 +
   19.29 +package pkg1;
   19.30 +
   19.31 +import java.io.ObjectInputStream;
   19.32 +import java.io.IOException;
   19.33 +import java.io.Serializable;
   19.34 +
   19.35 +/**
   19.36 + * A class comment for testing.
   19.37 + *
   19.38 + * @author      Bhavesh Patel
   19.39 + * @see C1
   19.40 + * @since       JDK1.0
   19.41 + */
   19.42 +
   19.43 +public class C2 implements Serializable {
   19.44 +
   19.45 +    /**
   19.46 +     * This field indicates title.
   19.47 +     */
   19.48 +    String title;
   19.49 +
   19.50 +    public static enum ModalType {
   19.51 +        NO_EXCLUDE
   19.52 +    };
   19.53 +
   19.54 +    /**
   19.55 +     * Constructor.
   19.56 +     *
   19.57 +     */
   19.58 +     public C2() {
   19.59 +
   19.60 +     }
   19.61 +
   19.62 +     public C2(String title) {
   19.63 +
   19.64 +     }
   19.65 +
   19.66 +     /**
   19.67 +     * Set visible.
   19.68 +     *
   19.69 +     * @param set boolean
   19.70 +     * @since 1.4
   19.71 +     * @deprecated As of JDK version 1.5, replaced by
   19.72 +     * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
   19.73 +     */
   19.74 +     @Deprecated
   19.75 +     public void setVisible(boolean set) {
   19.76 +     }
   19.77 +
   19.78 +     /**
   19.79 +     * Reads the object stream.
   19.80 +     *
   19.81 +     * @param s ObjectInputStream
   19.82 +     * @throws <code>IOException</code>
   19.83 +     * @deprecated As of JDK version 1.5, replaced by
   19.84 +     * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
   19.85 +     */
   19.86 +     @Deprecated
   19.87 +     public void readObject(ObjectInputStream s) throws IOException {
   19.88 +     }
   19.89 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C3.java	Thu Feb 19 18:04:54 2009 -0800
    20.3 @@ -0,0 +1,65 @@
    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 pkg1;
   20.30 +
   20.31 +import java.io.Serializable;
   20.32 +
   20.33 +/**
   20.34 + * Test for Serializable
   20.35 + *
   20.36 + * @author Bhavesh Patel
   20.37 + * @deprecated This class is no longer used.
   20.38 + */
   20.39 +@Deprecated
   20.40 +public abstract class C3 implements Serializable {
   20.41 +
   20.42 +    /**
   20.43 +     * The name for this class.
   20.44 +     *
   20.45 +     * @serial
   20.46 +     */
   20.47 +    private String name;
   20.48 +
   20.49 +    /**
   20.50 +     * @serial
   20.51 +     */
   20.52 +    private int publicKey;
   20.53 +
   20.54 +    /**
   20.55 +     * Constructor for serialization only.
   20.56 +     */
   20.57 +    protected C3() {
   20.58 +
   20.59 +    }
   20.60 +
   20.61 +    /**
   20.62 +     * Prints general information.
   20.63 +     *
   20.64 +     */
   20.65 +    public void printInfo() {
   20.66 +
   20.67 +    }
   20.68 +}
    21.1 --- a/test/tools/javac/6304921/T6304921.out	Tue Feb 17 09:07:14 2009 -0800
    21.2 +++ b/test/tools/javac/6304921/T6304921.out	Thu Feb 19 18:04:54 2009 -0800
    21.3 @@ -1,18 +1,18 @@
    21.4  T6304921.java:671/671/680: warning: [rawtypes] found raw type: java.util.ArrayList
    21.5 -missing type parameters for generic class java.util.ArrayList<E>
    21.6          List<Integer> list = new ArrayList();
    21.7                                   ^
    21.8 +  missing type parameters for generic class java.util.ArrayList<E>
    21.9  T6304921.java:667/667/682: warning: [unchecked] unchecked conversion
   21.10 -found   : java.util.ArrayList
   21.11 -required: java.util.List<java.lang.Integer>
   21.12          List<Integer> list = new ArrayList();
   21.13                               ^
   21.14 +  required: java.util.List<java.lang.Integer>
   21.15 +  found:    java.util.ArrayList
   21.16  error: warnings found and -Werror specified
   21.17  T6304921.java:727/733/737: cannot find symbol
   21.18 -symbol  : variable orr
   21.19 -location: class java.lang.System
   21.20          System.orr.println("abc"); // name not found
   21.21                ^
   21.22 +  symbol:   variable orr
   21.23 +  location: class java.lang.System
   21.24  T6304921.java:812/816/822: operator + cannot be applied to int,boolean
   21.25          return 123 + true; // bad binary expression
   21.26                     ^
    22.1 --- a/test/tools/javac/6668794/badClass/Test.java	Tue Feb 17 09:07:14 2009 -0800
    22.2 +++ b/test/tools/javac/6668794/badClass/Test.java	Thu Feb 19 18:04:54 2009 -0800
    22.3 @@ -54,8 +54,8 @@
    22.4              throw new Error("no diagnostics generated");
    22.5  
    22.6          String expected = "B.java:6:6: compiler.err.cant.access: p.A, " +
    22.7 -            "(- compiler.misc.bad.class.file.header: A.class, " +
    22.8 -            "(- compiler.misc.class.file.wrong.class: q.A))";
    22.9 +            "(compiler.misc.bad.class.file.header: A.class, " +
   22.10 +            "(compiler.misc.class.file.wrong.class: q.A))";
   22.11  
   22.12          if (!out[0].equals(expected)) {
   22.13              System.err.println("expected: " + expected);
    23.1 --- a/test/tools/javac/6668794/badSource/Test.out	Tue Feb 17 09:07:14 2009 -0800
    23.2 +++ b/test/tools/javac/6668794/badSource/Test.out	Thu Feb 19 18:04:54 2009 -0800
    23.3 @@ -1,1 +1,1 @@
    23.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))
    23.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))
    24.1 --- a/test/tools/javac/6758789/T6758789b.out	Tue Feb 17 09:07:14 2009 -0800
    24.2 +++ b/test/tools/javac/6758789/T6758789b.out	Thu Feb 19 18:04:54 2009 -0800
    24.3 @@ -1,4 +1,4 @@
    24.4 -T6758789b.java:39:11: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
    24.5 +T6758789b.java:39:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
    24.6  T6758789b.java:39:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
    24.7  - compiler.err.warnings.and.werror
    24.8  1 error
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/test/tools/javac/Diagnostics/6769027/T6769027.java	Thu Feb 19 18:04:54 2009 -0800
    25.3 @@ -0,0 +1,499 @@
    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.
   25.11 + *
   25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.15 + * version 2 for more details (a copy is included in the LICENSE file that
   25.16 + * accompanied this code).
   25.17 + *
   25.18 + * You should have received a copy of the GNU General Public License version
   25.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.21 + *
   25.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   25.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   25.24 + * have any questions.
   25.25 + */
   25.26 +
   25.27 +/**
   25.28 + * @test
   25.29 + * @bug     6769027
   25.30 + * @summary Source line should be displayed immediately after the first diagnostic line
   25.31 + * @author  Maurizio Cimadamore
   25.32 + * @run main/othervm T6769027
   25.33 + */
   25.34 +import java.net.URI;
   25.35 +import java.util.regex.Matcher;
   25.36 +import javax.tools.*;
   25.37 +import com.sun.tools.javac.util.*;
   25.38 +
   25.39 +public class T6769027 {
   25.40 +
   25.41 +    enum OutputKind {
   25.42 +        RAW("rawDiagnostics","rawDiagnostics"),
   25.43 +        BASIC("","");
   25.44 +
   25.45 +        String key;
   25.46 +        String value;
   25.47 +
   25.48 +        void init(Options opts) {
   25.49 +            opts.put(key, value);
   25.50 +        }
   25.51 +
   25.52 +        OutputKind(String key, String value) {
   25.53 +            this.key = key;
   25.54 +            this.value = value;
   25.55 +        }
   25.56 +    }
   25.57 +
   25.58 +    enum CaretKind {
   25.59 +        DEFAULT("", ""),
   25.60 +        SHOW("showCaret","true"),
   25.61 +        HIDE("showCaret","false");
   25.62 +
   25.63 +        String key;
   25.64 +        String value;
   25.65 +
   25.66 +        void init(Options opts) {
   25.67 +            opts.put(key, value);
   25.68 +        }
   25.69 +
   25.70 +        CaretKind(String key, String value) {
   25.71 +            this.key = key;
   25.72 +            this.value = value;
   25.73 +        }
   25.74 +
   25.75 +        boolean isEnabled() {
   25.76 +            return this == DEFAULT || this == SHOW;
   25.77 +        }
   25.78 +    }
   25.79 +
   25.80 +    enum SourceLineKind {
   25.81 +        DEFAULT("", ""),
   25.82 +        AFTER_SUMMARY("sourcePosition", "top"),
   25.83 +        BOTTOM("sourcePosition", "bottom");
   25.84 +
   25.85 +        String key;
   25.86 +        String value;
   25.87 +
   25.88 +        void init(Options opts) {
   25.89 +            opts.put(key, value);
   25.90 +        }
   25.91 +
   25.92 +        SourceLineKind(String key, String value) {
   25.93 +            this.key = key;
   25.94 +            this.value = value;
   25.95 +        }
   25.96 +
   25.97 +        boolean isAfterSummary() {
   25.98 +            return this == DEFAULT || this == AFTER_SUMMARY;
   25.99 +        }
  25.100 +    }
  25.101 +
  25.102 +    enum XDiagsSource {
  25.103 +        DEFAULT(""),
  25.104 +        SOURCE("source"),
  25.105 +        NO_SOURCE("-source");
  25.106 +
  25.107 +        String flag;
  25.108 +
  25.109 +        void init(Options opts) {
  25.110 +            if (this != DEFAULT) {
  25.111 +                String flags = opts.get("diags");
  25.112 +                flags = flags == null ? flag : flags + "," + flag;
  25.113 +                opts.put("diags", flags);
  25.114 +            }
  25.115 +        }
  25.116 +
  25.117 +        XDiagsSource(String flag) {
  25.118 +            this.flag = flag;
  25.119 +        }
  25.120 +
  25.121 +        String getOutput(CaretKind caretKind, IndentKind indent, OutputKind outKind) {
  25.122 +            String spaces = (outKind == OutputKind.BASIC) ? indent.string : "";
  25.123 +            return "\n" + spaces + "This is a source line" +
  25.124 +                   (caretKind.isEnabled() ? "\n" + spaces + "     ^" : "");
  25.125 +        }
  25.126 +    }
  25.127 +
  25.128 +    enum XDiagsCompact {
  25.129 +        DEFAULT(""),
  25.130 +        COMPACT("short"),
  25.131 +        NO_COMPACT("-short");
  25.132 +
  25.133 +        String flag;
  25.134 +
  25.135 +        void init(Options opts) {
  25.136 +            if (this != DEFAULT) {
  25.137 +                String flags = opts.get("diags");
  25.138 +                flags = flags == null ? flag : flags + "," + flag;
  25.139 +                opts.put("diags", flags);
  25.140 +            }
  25.141 +        }
  25.142 +
  25.143 +        XDiagsCompact(String flag) {
  25.144 +            this.flag = flag;
  25.145 +        }
  25.146 +    }
  25.147 +
  25.148 +    enum ErrorKind {
  25.149 +        SINGLE("single",
  25.150 +            "compiler.err.single: Hello!",
  25.151 +            "KXThis is a test error message Hello!"),
  25.152 +        DOUBLE("double",
  25.153 +            "compiler.err.double: Hello!",
  25.154 +            "KXThis is a test error message.\n" +
  25.155 +            "KXYThis is another line of the above error message Hello!");
  25.156 +
  25.157 +        String key;
  25.158 +        String rawOutput;
  25.159 +        String nonRawOutput;
  25.160 +
  25.161 +        String key() {
  25.162 +            return key;
  25.163 +        }
  25.164 +
  25.165 +        ErrorKind(String key, String rawOutput, String nonRawOutput) {
  25.166 +            this.key = key;
  25.167 +            this.rawOutput = rawOutput;
  25.168 +            this.nonRawOutput = nonRawOutput;
  25.169 +        }
  25.170 +
  25.171 +        String getOutput(OutputKind outKind, IndentKind summaryIndent, IndentKind detailsIndent) {
  25.172 +            return outKind == OutputKind.RAW ?
  25.173 +                rawOutput :
  25.174 +                nonRawOutput.replace("X", summaryIndent.string).replace("Y", detailsIndent.string).replace("K", "");
  25.175 +        }
  25.176 +
  25.177 +        String getOutput(OutputKind outKind, IndentKind summaryIndent, IndentKind detailsIndent, String indent) {
  25.178 +            return outKind == OutputKind.RAW ?
  25.179 +                rawOutput :
  25.180 +                nonRawOutput.replace("X", summaryIndent.string).replace("Y", detailsIndent.string).replace("K", indent);
  25.181 +        }
  25.182 +    }
  25.183 +
  25.184 +    enum MultilineKind {
  25.185 +        NONE(0),
  25.186 +        DOUBLE(1),
  25.187 +        NESTED(2),
  25.188 +        DOUBLE_NESTED(3);
  25.189 +
  25.190 +        static String[][] rawTemplates = {
  25.191 +            {"", ",{(E),(E)}", ",{(E,{(E)})}", ",{(E,{(E)}),(E,{(E)})}"}, //ENABLED
  25.192 +            {"", "", "", "",""}, //DISABLED
  25.193 +            {"", ",{(E)}", ",{(E,{(E)})}", ",{(E,{(E)})}"}, //LIMIT_LENGTH
  25.194 +            {"", ",{(E),(E)}", ",{(E)}", ",{(E),(E)}"}, //LIMIT_DEPTH
  25.195 +            {"", ",{(E)}", ",{(E)}", ",{(E)}"}}; //LIMIT_BOTH
  25.196 +
  25.197 +        static String[][] basicTemplates = {
  25.198 +            {"", "\nE\nE", "\nE\nQ", "\nE\nQ\nE\nQ"}, //ENABLED
  25.199 +            {"", "", "", "",""}, //DISABLED
  25.200 +            {"", "\nE", "\nE\nQ", "\nE\nQ"}, //LIMIT_LENGTH
  25.201 +            {"", "\nE\nE", "\nE", "\nE\nE"}, //LIMIT_DEPTH
  25.202 +            {"", "\nE", "\nE", "\nE"}}; //LIMIT_BOTH
  25.203 +
  25.204 +
  25.205 +        int index;
  25.206 +
  25.207 +        MultilineKind (int index) {
  25.208 +            this.index = index;
  25.209 +        }
  25.210 +
  25.211 +        boolean isDouble() {
  25.212 +            return this == DOUBLE || this == DOUBLE_NESTED;
  25.213 +        }
  25.214 +
  25.215 +        boolean isNested() {
  25.216 +            return this == NESTED || this == DOUBLE_NESTED;
  25.217 +        }
  25.218 +
  25.219 +        String getOutput(OutputKind outKind, ErrorKind errKind, MultilinePolicy policy,
  25.220 +                IndentKind summaryIndent, IndentKind detailsIndent, IndentKind multiIndent) {
  25.221 +            String constIndent = (errKind == ErrorKind.DOUBLE) ?
  25.222 +                summaryIndent.string + detailsIndent.string :
  25.223 +                summaryIndent.string;
  25.224 +            constIndent += multiIndent.string;
  25.225 +
  25.226 +            String errMsg1 = errKind.getOutput(outKind, summaryIndent, detailsIndent, constIndent);
  25.227 +            String errMsg2 = errKind.getOutput(outKind, summaryIndent, detailsIndent, constIndent + constIndent);
  25.228 +
  25.229 +            errMsg1 = errMsg1.replaceAll("compiler.err", "compiler.misc");
  25.230 +            errMsg1 = errMsg1.replaceAll("error message", "subdiagnostic");
  25.231 +            errMsg2 = errMsg2.replaceAll("compiler.err", "compiler.misc");
  25.232 +            errMsg2 = errMsg2.replaceAll("error message", "subdiagnostic");
  25.233 +
  25.234 +            String template = outKind == OutputKind.RAW ?
  25.235 +                rawTemplates[policy.index][index] :
  25.236 +                basicTemplates[policy.index][index];
  25.237 +
  25.238 +            template = template.replaceAll("E", errMsg1);
  25.239 +            return template.replaceAll("Q", errMsg2);
  25.240 +        }
  25.241 +    }
  25.242 +
  25.243 +    enum MultilinePolicy {
  25.244 +        ENABLED(0, "multilinePolicy", "enabled"),
  25.245 +        DISABLED(1, "multilinePolicy", "disabled"),
  25.246 +        LIMIT_LENGTH(2, "multilinePolicy", "limit:1:*"),
  25.247 +        LIMIT_DEPTH(3, "multilinePolicy", "limit:*:1"),
  25.248 +        LIMIT_BOTH(4, "multilinePolicy", "limit:1:1");
  25.249 +
  25.250 +        String name;
  25.251 +        String value;
  25.252 +        int index;
  25.253 +
  25.254 +        MultilinePolicy(int index, String name, String value) {
  25.255 +            this.name = name;
  25.256 +            this.value = value;
  25.257 +            this.index = index;
  25.258 +        }
  25.259 +
  25.260 +        void init(Options options) {
  25.261 +            options.put(name, value);
  25.262 +        }
  25.263 +    }
  25.264 +
  25.265 +    enum PositionKind {
  25.266 +        NOPOS(Position.NOPOS, "- ", "error: "),
  25.267 +        POS(5, "/Test.java:1:6: ", "myfo:/Test.java:1: ");
  25.268 +
  25.269 +        int pos;
  25.270 +        String rawOutput;
  25.271 +        String nonRawOutput;
  25.272 +
  25.273 +        PositionKind(int pos, String rawOutput, String nonRawOutput) {
  25.274 +            this.pos = pos;
  25.275 +            this.rawOutput = rawOutput;
  25.276 +            this.nonRawOutput = nonRawOutput;
  25.277 +        }
  25.278 +
  25.279 +        JCDiagnostic.DiagnosticPosition pos() {
  25.280 +            return new JCDiagnostic.SimpleDiagnosticPosition(pos);
  25.281 +        }
  25.282 +
  25.283 +        String getOutput(OutputKind outputKind) {
  25.284 +            return outputKind == OutputKind.RAW ?
  25.285 +                rawOutput :
  25.286 +                nonRawOutput;
  25.287 +        }
  25.288 +    }
  25.289 +
  25.290 +    static class MyFileObject extends SimpleJavaFileObject {
  25.291 +        private String text;
  25.292 +        public MyFileObject(String text) {
  25.293 +            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
  25.294 +            this.text = text;
  25.295 +        }
  25.296 +        @Override
  25.297 +        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
  25.298 +            return text;
  25.299 +        }
  25.300 +    }
  25.301 +
  25.302 +    enum IndentKind {
  25.303 +        NONE(""),
  25.304 +        CUSTOM("   ");
  25.305 +
  25.306 +        String string;
  25.307 +
  25.308 +        IndentKind(String indent) {
  25.309 +            string = indent;
  25.310 +        }
  25.311 +    }
  25.312 +
  25.313 +    class MyLog extends Log {
  25.314 +        MyLog(Context ctx) {
  25.315 +            super(ctx);
  25.316 +        }
  25.317 +
  25.318 +        @Override
  25.319 +        protected java.io.PrintWriter getWriterForDiagnosticType(JCDiagnostic.DiagnosticType dt) {
  25.320 +            return new java.io.PrintWriter(System.out);
  25.321 +        }
  25.322 +
  25.323 +        @Override
  25.324 +        protected boolean shouldReport(JavaFileObject jfo, int pos) {
  25.325 +            return true;
  25.326 +        }
  25.327 +    }
  25.328 +
  25.329 +    int nerrors = 0;
  25.330 +
  25.331 +    void exec(OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
  25.332 +            MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
  25.333 +            XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
  25.334 +            IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
  25.335 +            IndentKind subdiagsIndent) {
  25.336 +        Context ctx = new Context();
  25.337 +        Options options = Options.instance(ctx);
  25.338 +        outputKind.init(options);
  25.339 +        multiPolicy.init(options);
  25.340 +        xdiagsSource.init(options);
  25.341 +        xdiagsCompact.init(options);
  25.342 +        caretKind.init(options);
  25.343 +        sourceLineKind.init(options);
  25.344 +        String indentString = "";
  25.345 +        indentString = (summaryIndent == IndentKind.CUSTOM) ? "3" : "0";
  25.346 +        indentString += (detailsIndent == IndentKind.CUSTOM) ? "|3" : "|0";
  25.347 +        indentString += (sourceIndent == IndentKind.CUSTOM) ? "|3" : "|0";
  25.348 +        indentString += (subdiagsIndent == IndentKind.CUSTOM) ? "|3" : "|0";
  25.349 +        options.put("diagsIndentation", indentString);
  25.350 +        MyLog log = new MyLog(ctx);
  25.351 +        JavacMessages messages = JavacMessages.instance(ctx);
  25.352 +        messages.add("tester");
  25.353 +        JCDiagnostic.Factory diags = JCDiagnostic.Factory.instance(ctx);
  25.354 +        log.useSource(new MyFileObject("This is a source line"));
  25.355 +        JCDiagnostic d = diags.error(log.currentSource(),
  25.356 +            posKind.pos(),
  25.357 +            errorKind.key(), "Hello!");
  25.358 +        if (multiKind != MultilineKind.NONE) {
  25.359 +            JCDiagnostic sub = diags.fragment(errorKind.key(), "Hello!");
  25.360 +            if (multiKind.isNested())
  25.361 +                sub = new JCDiagnostic.MultilineDiagnostic(sub, List.of(sub));
  25.362 +            List<JCDiagnostic> subdiags = multiKind.isDouble() ?
  25.363 +                List.of(sub, sub) :
  25.364 +                List.of(sub);
  25.365 +            d = new JCDiagnostic.MultilineDiagnostic(d, subdiags);
  25.366 +        }
  25.367 +        String diag = log.getDiagnosticFormatter().format(d, messages.getCurrentLocale());
  25.368 +        checkOutput(diag,
  25.369 +                outputKind,
  25.370 +                errorKind,
  25.371 +                multiKind,
  25.372 +                multiPolicy,
  25.373 +                posKind,
  25.374 +                xdiagsSource,
  25.375 +                xdiagsCompact,
  25.376 +                caretKind,
  25.377 +                sourceLineKind,
  25.378 +                summaryIndent,
  25.379 +                detailsIndent,
  25.380 +                sourceIndent,
  25.381 +                subdiagsIndent);
  25.382 +    }
  25.383 +
  25.384 +    void test() {
  25.385 +        for (OutputKind outputKind : OutputKind.values()) {
  25.386 +            for (ErrorKind errKind : ErrorKind.values()) {
  25.387 +                for (MultilineKind multiKind : MultilineKind.values()) {
  25.388 +                    for (MultilinePolicy multiPolicy : MultilinePolicy.values()) {
  25.389 +                        for (PositionKind posKind : PositionKind.values()) {
  25.390 +                            for (XDiagsSource xdiagsSource : XDiagsSource.values()) {
  25.391 +                                for (XDiagsCompact xdiagsCompact : XDiagsCompact.values()) {
  25.392 +                                    for (CaretKind caretKind : CaretKind.values()) {
  25.393 +                                        for (SourceLineKind sourceLineKind : SourceLineKind.values()) {
  25.394 +                                            for (IndentKind summaryIndent : IndentKind.values()) {
  25.395 +                                                for (IndentKind detailsIndent : IndentKind.values()) {
  25.396 +                                                    for (IndentKind sourceIndent : IndentKind.values()) {
  25.397 +                                                        for (IndentKind subdiagsIndent : IndentKind.values()) {
  25.398 +                                                            exec(outputKind,
  25.399 +                                                                errKind,
  25.400 +                                                                multiKind,
  25.401 +                                                                multiPolicy,
  25.402 +                                                                posKind,
  25.403 +                                                                xdiagsSource,
  25.404 +                                                                xdiagsCompact,
  25.405 +                                                                caretKind,
  25.406 +                                                                sourceLineKind,
  25.407 +                                                                summaryIndent,
  25.408 +                                                                detailsIndent,
  25.409 +                                                                sourceIndent,
  25.410 +                                                                subdiagsIndent);
  25.411 +                                                        }
  25.412 +                                                    }
  25.413 +                                                }
  25.414 +                                            }
  25.415 +                                        }
  25.416 +                                    }
  25.417 +                                }
  25.418 +                            }
  25.419 +                        }
  25.420 +                    }
  25.421 +                }
  25.422 +            }
  25.423 +        }
  25.424 +        if (nerrors != 0)
  25.425 +            throw new AssertionError(nerrors + " errors found");
  25.426 +    }
  25.427 +
  25.428 +    void printInfo(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
  25.429 +            MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
  25.430 +            XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
  25.431 +            IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
  25.432 +            IndentKind subdiagsIndent, String errorLine) {
  25.433 +        String sep = "*********************************************************";
  25.434 +        String desc = "raw=" + outputKind + " pos=" + posKind + " key=" + errorKind.key() +
  25.435 +                " multiline=" + multiKind +" multiPolicy=" + multiPolicy.value +
  25.436 +                " diags= " + java.util.Arrays.asList(xdiagsSource.flag, xdiagsCompact.flag) +
  25.437 +                " caret=" + caretKind + " sourcePosition=" + sourceLineKind +
  25.438 +                " summaryIndent=" + summaryIndent + " detailsIndent=" + detailsIndent +
  25.439 +                " sourceIndent=" + sourceIndent + " subdiagsIndent=" + subdiagsIndent;
  25.440 +        System.out.println(sep);
  25.441 +        System.out.println(desc);
  25.442 +        System.out.println(sep);
  25.443 +        System.out.println(msg);
  25.444 +        System.out.println("Diagnostic formatting problem - expected diagnostic...\n" + errorLine);
  25.445 +    }
  25.446 +
  25.447 +    void checkOutput(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
  25.448 +            MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
  25.449 +            XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
  25.450 +            IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
  25.451 +            IndentKind subdiagsIndent) {
  25.452 +        boolean shouldPrintSource = posKind == PositionKind.POS &&
  25.453 +                xdiagsSource != XDiagsSource.NO_SOURCE &&
  25.454 +                (xdiagsSource == XDiagsSource.SOURCE ||
  25.455 +                outputKind == OutputKind.BASIC);
  25.456 +        String errorLine = posKind.getOutput(outputKind) +
  25.457 +                errorKind.getOutput(outputKind, summaryIndent, detailsIndent);
  25.458 +        if (xdiagsCompact != XDiagsCompact.COMPACT)
  25.459 +            errorLine += multiKind.getOutput(outputKind, errorKind, multiPolicy, summaryIndent, detailsIndent, subdiagsIndent);
  25.460 +        String[] lines = errorLine.split("\n");
  25.461 +        if (xdiagsCompact == XDiagsCompact.COMPACT) {
  25.462 +            errorLine = lines[0];
  25.463 +            lines = new String[] {errorLine};
  25.464 +        }
  25.465 +        if (shouldPrintSource) {
  25.466 +            if (sourceLineKind.isAfterSummary()) {
  25.467 +                String sep = "\n";
  25.468 +                if (lines.length == 1) {
  25.469 +                    errorLine += "\n";
  25.470 +                    sep = "";
  25.471 +                }
  25.472 +                errorLine = errorLine.replaceFirst("\n",
  25.473 +                        Matcher.quoteReplacement(xdiagsSource.getOutput(caretKind, sourceIndent, outputKind) + sep));
  25.474 +            }
  25.475 +            else
  25.476 +                errorLine += xdiagsSource.getOutput(caretKind, sourceIndent, outputKind);
  25.477 +        }
  25.478 +
  25.479 +        if (!msg.equals(errorLine)) {
  25.480 +            printInfo(msg,
  25.481 +                    outputKind,
  25.482 +                    errorKind,
  25.483 +                    multiKind,
  25.484 +                    multiPolicy,
  25.485 +                    posKind,
  25.486 +                    xdiagsSource,
  25.487 +                    xdiagsCompact,
  25.488 +                    caretKind,
  25.489 +                    sourceLineKind,
  25.490 +                    summaryIndent,
  25.491 +                    detailsIndent,
  25.492 +                    sourceIndent,
  25.493 +                    subdiagsIndent,
  25.494 +                    errorLine);
  25.495 +            nerrors++;
  25.496 +        }
  25.497 +    }
  25.498 +
  25.499 +    public static void main(String... args) throws Exception {
  25.500 +        new T6769027().test();
  25.501 +    }
  25.502 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/test/tools/javac/Diagnostics/6769027/tester.properties	Thu Feb 19 18:04:54 2009 -0800
    26.3 @@ -0,0 +1,13 @@
    26.4 +compiler.err.single=\
    26.5 +    This is a test error message {0}
    26.6 +
    26.7 +compiler.err.double=\
    26.8 +    This is a test error message.\n\
    26.9 +	This is another line of the above error message {0}
   26.10 +
   26.11 +compiler.misc.single=\
   26.12 +    This is a test subdiagnostic {0}
   26.13 +
   26.14 +compiler.misc.double=\
   26.15 +    This is a test subdiagnostic.\n\
   26.16 +	This is another line of the above subdiagnostic {0}
    27.1 --- a/test/tools/javac/ExtendArray.out	Tue Feb 17 09:07:14 2009 -0800
    27.2 +++ b/test/tools/javac/ExtendArray.out	Thu Feb 19 18:04:54 2009 -0800
    27.3 @@ -1,6 +1,6 @@
    27.4  ExtendArray.java:11: unexpected type
    27.5 -found   : java.lang.Object[]
    27.6 -required: class
    27.7  public class ExtendArray extends Object[] {}
    27.8                                         ^
    27.9 +  required: class
   27.10 +  found:    java.lang.Object[]
   27.11  1 error
    28.1 --- a/test/tools/javac/T5048776b.out	Tue Feb 17 09:07:14 2009 -0800
    28.2 +++ b/test/tools/javac/T5048776b.out	Thu Feb 19 18:04:54 2009 -0800
    28.3 @@ -1,3 +1,3 @@
    28.4 -T5048776.java:12:10: compiler.warn.override.varargs.missing: (- compiler.misc.varargs.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1)
    28.5 -T5048776.java:20:10: compiler.warn.override.varargs.extra: (- compiler.misc.varargs.override: foo(java.lang.Object[]), A2a, foo(java.lang.Object...), A2)
    28.6 +T5048776.java:12:10: compiler.warn.override.varargs.missing: (compiler.misc.varargs.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1)
    28.7 +T5048776.java:20:10: compiler.warn.override.varargs.extra: (compiler.misc.varargs.override: foo(java.lang.Object[]), A2a, foo(java.lang.Object...), A2)
    28.8  2 warnings
    29.1 --- a/test/tools/javac/T6214885a.out	Tue Feb 17 09:07:14 2009 -0800
    29.2 +++ b/test/tools/javac/T6214885a.out	Thu Feb 19 18:04:54 2009 -0800
    29.3 @@ -1,6 +1,6 @@
    29.4  T6214885.java:11 cannot find symbol
    29.5 -symbol  : variable x
    29.6 -location: class T6214885
    29.7          x = 1;
    29.8          ^
    29.9 +  symbol:   variable x
   29.10 +  location: class T6214885
   29.11  1 error
    30.1 --- a/test/tools/javac/T6214885b.out	Tue Feb 17 09:07:14 2009 -0800
    30.2 +++ b/test/tools/javac/T6214885b.out	Thu Feb 19 18:04:54 2009 -0800
    30.3 @@ -1,6 +1,6 @@
    30.4  T6214885.java:11:9 cannot find symbol
    30.5 -symbol  : variable x
    30.6 -location: class T6214885
    30.7          x = 1;
    30.8          ^
    30.9 +  symbol:   variable x
   30.10 +  location: class T6214885
   30.11  1 error
    31.1 --- a/test/tools/javac/T6230128.out	Tue Feb 17 09:07:14 2009 -0800
    31.2 +++ b/test/tools/javac/T6230128.out	Thu Feb 19 18:04:54 2009 -0800
    31.3 @@ -1,2 +1,2 @@
    31.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
    31.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
    31.6  1 error
    32.1 --- a/test/tools/javac/annotations/6365854/test1.out	Tue Feb 17 09:07:14 2009 -0800
    32.2 +++ b/test/tools/javac/annotations/6365854/test1.out	Thu Feb 19 18:04:54 2009 -0800
    32.3 @@ -1,2 +1,2 @@
    32.4 -- compiler.warn.annotation.method.not.found.reason: test.annotation.TestAnnotation, test, (- compiler.misc.class.file.not.found: test.annotation.TestAnnotation)
    32.5 +- compiler.warn.annotation.method.not.found.reason: test.annotation.TestAnnotation, test, (compiler.misc.class.file.not.found: test.annotation.TestAnnotation)
    32.6  1 warning
    33.1 --- a/test/tools/javac/cast/6557182/T6557182.out	Tue Feb 17 09:07:14 2009 -0800
    33.2 +++ b/test/tools/javac/cast/6557182/T6557182.out	Thu Feb 19 18:04:54 2009 -0800
    33.3 @@ -1,4 +1,4 @@
    33.4 -T6557182.java:35:56: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer>
    33.5 -T6557182.java:39:56: compiler.warn.prob.found.req: (- compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer>
    33.6 +T6557182.java:35:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer>
    33.7 +T6557182.java:39:56: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer>
    33.8  1 error
    33.9  1 warning
    34.1 --- a/test/tools/javac/cast/6665356/T6665356.out	Tue Feb 17 09:07:14 2009 -0800
    34.2 +++ b/test/tools/javac/cast/6665356/T6665356.out	Thu Feb 19 18:04:54 2009 -0800
    34.3 @@ -1,8 +1,8 @@
    34.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>
    34.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>
    34.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>
    34.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>
    34.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>
    34.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>
   34.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>
   34.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>
   34.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>
   34.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>
   34.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>
   34.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>
   34.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>
   34.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>
   34.18  7 errors
   34.19 \ No newline at end of file
    35.1 --- a/test/tools/javac/cast/6795580/T6795580.out	Tue Feb 17 09:07:14 2009 -0800
    35.2 +++ b/test/tools/javac/cast/6795580/T6795580.out	Thu Feb 19 18:04:54 2009 -0800
    35.3 @@ -1,8 +1,8 @@
    35.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>[]
    35.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>[]
    35.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>[]
    35.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>[]
    35.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>[]
    35.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>[]
   35.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>[]
   35.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>[]
   35.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>[]
   35.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>[]
   35.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>[]
   35.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>[]
   35.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>[]
   35.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>[]
   35.18  7 errors
    36.1 --- a/test/tools/javac/generics/6207386/T6207386.out	Tue Feb 17 09:07:14 2009 -0800
    36.2 +++ b/test/tools/javac/generics/6207386/T6207386.out	Thu Feb 19 18:04:54 2009 -0800
    36.3 @@ -1,2 +1,2 @@
    36.4 -T6207386.java:13:30: compiler.err.prob.found.req: (- compiler.misc.incompatible.types), X, T6207386.F<? super X>
    36.5 +T6207386.java:13:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), X, T6207386.F<? super X>
    36.6  1 error
    37.1 --- a/test/tools/javac/generics/inference/6315770/T6315770.out	Tue Feb 17 09:07:14 2009 -0800
    37.2 +++ b/test/tools/javac/generics/inference/6315770/T6315770.out	Thu Feb 19 18:04:54 2009 -0800
    37.3 @@ -1,3 +1,3 @@
    37.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)
    37.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>
    37.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)
    37.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>
    37.8  2 errors
    38.1 --- a/test/tools/javac/generics/inference/6718364/T6718364.out	Tue Feb 17 09:07:14 2009 -0800
    38.2 +++ b/test/tools/javac/generics/inference/6718364/T6718364.out	Thu Feb 19 18:04:54 2009 -0800
    38.3 @@ -1,3 +1,3 @@
    38.4 -T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
    38.5 +T6718364.java:36:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
    38.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
    38.7  2 warnings
    38.8 \ No newline at end of file
    39.1 --- a/test/tools/javac/generics/typevars/6680106/T6680106.out	Tue Feb 17 09:07:14 2009 -0800
    39.2 +++ b/test/tools/javac/generics/typevars/6680106/T6680106.out	Thu Feb 19 18:04:54 2009 -0800
    39.3 @@ -1,13 +1,13 @@
    39.4 -T6680106.java:34:25: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
    39.5 -T6680106.java:35:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
    39.6 -T6680106.java:35:40: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
    39.7 -T6680106.java:36:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
    39.8 -T6680106.java:36:40: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
    39.9 -T6680106.java:36:55: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   39.10 -T6680106.java:37:30: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   39.11 -T6680106.java:38:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
   39.12 -T6680106.java:38:50: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   39.13 -T6680106.java:39:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
   39.14 -T6680106.java:39:50: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
   39.15 -T6680106.java:39:70: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   39.16 +T6680106.java:34:25: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   39.17 +T6680106.java:35:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   39.18 +T6680106.java:35:40: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   39.19 +T6680106.java:36:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   39.20 +T6680106.java:36:40: compiler.err.type.found.req: U[], (compiler.misc.type.req.class)
   39.21 +T6680106.java:36:55: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   39.22 +T6680106.java:37:30: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   39.23 +T6680106.java:38:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   39.24 +T6680106.java:38:50: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   39.25 +T6680106.java:39:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   39.26 +T6680106.java:39:50: compiler.err.type.found.req: U[], (compiler.misc.type.req.class)
   39.27 +T6680106.java:39:70: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   39.28  12 errors
   39.29 \ No newline at end of file
    40.1 --- a/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.out	Tue Feb 17 09:07:14 2009 -0800
    40.2 +++ b/test/tools/javac/missingSuperRecovery/MissingSuperRecovery.out	Thu Feb 19 18:04:54 2009 -0800
    40.3 @@ -1,5 +1,5 @@
    40.4  MissingSuperRecovery.java:15: cannot access base
    40.5 -class file for base not found
    40.6  public class MissingSuperRecovery extends impl {
    40.7         ^
    40.8 +  class file for base not found
    40.9  1 error
    41.1 --- a/test/tools/javac/unicode/UnicodeNewline.out	Tue Feb 17 09:07:14 2009 -0800
    41.2 +++ b/test/tools/javac/unicode/UnicodeNewline.out	Thu Feb 19 18:04:54 2009 -0800
    41.3 @@ -1,6 +1,6 @@
    41.4  UnicodeNewline.java:11: cannot find symbol
    41.5 -symbol  : class xyzzy
    41.6 -location: class UnicodeNewline
    41.7      xyzzy plugh; // error should be HERE
    41.8      ^
    41.9 +  symbol:   class xyzzy
   41.10 +  location: class UnicodeNewline
   41.11  1 error

mercurial