langtools/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java
author jjg
Thu, 10 Jun 2010 16:08:01 -0700
changeset 5847 1908176fd6e3
parent 5520 86e4b9a9da40
child 14259 fb94a1df0d53
permissions -rw-r--r--
6944312: Potential rebranding issues in openjdk/langtools repository sources Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3380
diff changeset
     2
 * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
     4
 *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3380
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3380
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    10
 *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    15
 * accompanied this code).
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    16
 *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3380
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3380
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3380
diff changeset
    23
 * questions.
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    24
 */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    25
package com.sun.tools.javac.api;
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    26
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    27
import java.util.Locale;
2085
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
    28
import java.util.Set;
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    29
import javax.tools.Diagnostic;
2085
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
    30
import com.sun.tools.javac.api.DiagnosticFormatter.*;
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    31
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    32
/**
2085
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
    33
 * Provides simple functionalities for javac diagnostic formatting.
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    34
 * @param <D> type of diagnostic handled by this formatter
3380
a6c2bcab0fec 6865399: some javac files are missing Sun internal API comment
jjg
parents: 2212
diff changeset
    35
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    36
 * <p><b>This is NOT part of any supported API.
3380
a6c2bcab0fec 6865399: some javac files are missing Sun internal API comment
jjg
parents: 2212
diff changeset
    37
 * If you write code that depends on this, you do so at your own risk.
a6c2bcab0fec 6865399: some javac files are missing Sun internal API comment
jjg
parents: 2212
diff changeset
    38
 * This code and its internal interfaces are subject to change or
a6c2bcab0fec 6865399: some javac files are missing Sun internal API comment
jjg
parents: 2212
diff changeset
    39
 * deletion without notice.</b>
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    40
 */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    41
public interface DiagnosticFormatter<D extends Diagnostic<?>> {
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    42
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    43
    /**
2085
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
    44
     * Whether the source code output for this diagnostic is to be displayed.
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    45
     *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    46
     * @param diag diagnostic to be formatted
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    47
     * @return true if the source line this diagnostic refers to is to be displayed
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    48
     */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    49
    boolean displaySource(D diag);
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    50
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    51
    /**
2085
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
    52
     * Format the contents of a diagnostics.
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    53
     *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    54
     * @param diag the diagnostic to be formatted
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    55
     * @param l locale object to be used for i18n
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    56
     * @return a string representing the diagnostic
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    57
     */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    58
    public String format(D diag, Locale l);
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    59
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    60
    /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    61
     * Controls the way in which a diagnostic message is displayed.
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    62
     *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    63
     * @param diag diagnostic to be formatted
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    64
     * @param l locale object to be used for i18n
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    65
     * @return string representation of the diagnostic message
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    66
     */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    67
    public String formatMessage(D diag,Locale l);
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    68
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    69
    /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    70
     * Controls the way in which a diagnostic kind is displayed.
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    71
     *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    72
     * @param diag diagnostic to be formatted
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    73
     * @param l locale object to be used for i18n
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    74
     * @return string representation of the diagnostic prefix
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    75
     */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    76
    public String formatKind(D diag, Locale l);
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    77
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    78
    /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    79
     * Controls the way in which a diagnostic source is displayed.
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    80
     *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    81
     * @param diag diagnostic to be formatted
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    82
     * @param l locale object to be used for i18n
1109
853d8c191eac 6733837: Recent work on javac diagnostic affected javac output
mcimadamore
parents: 942
diff changeset
    83
     * @param fullname whether the source fullname should be printed
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    84
     * @return string representation of the diagnostic source
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    85
     */
1109
853d8c191eac 6733837: Recent work on javac diagnostic affected javac output
mcimadamore
parents: 942
diff changeset
    86
    public String formatSource(D diag, boolean fullname, Locale l);
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    87
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    88
    /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    89
     * Controls the way in which a diagnostic position is displayed.
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    90
     *
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    91
     * @param diag diagnostic to be formatted
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    92
     * @param pk enum constant representing the position kind
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    93
     * @param l locale object to be used for i18n
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    94
     * @return string representation of the diagnostic position
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    95
     */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    96
    public String formatPosition(D diag, PositionKind pk, Locale l);
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    97
    //where
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    98
    /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
    99
     * This enum defines a set of constants for all the kinds of position
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   100
     * that a diagnostic can be asked for. All positions are intended to be
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   101
     * relative to a given diagnostic source.
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   102
     */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   103
    public enum PositionKind {
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   104
        /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   105
         * Start position
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   106
         */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   107
        START,
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   108
        /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   109
         * End position
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   110
         */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   111
        END,
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   112
        /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   113
         * Line number
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   114
         */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   115
        LINE,
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   116
        /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   117
         * Column number
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   118
         */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   119
        COLUMN,
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   120
        /**
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   121
         * Offset position
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   122
         */
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   123
        OFFSET
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   124
    }
2085
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   125
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   126
    /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   127
     * Get a list of all the enabled verbosity options.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   128
     * @return verbosity options
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   129
     */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   130
    public Configuration getConfiguration();
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   131
    //where
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   132
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   133
    /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   134
     * This interface provides functionalities for tuning the output of a
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   135
     * diagnostic formatter in multiple ways.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   136
     */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   137
    interface Configuration {
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   138
        /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   139
         * Configure the set of diagnostic parts that should be displayed
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   140
         * by the formatter.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   141
         * @param options options to set
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   142
         */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   143
        public void setVisible(Set<DiagnosticPart> visibleParts);
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   144
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   145
        /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   146
         * Retrieve the set of diagnostic parts that should be displayed
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   147
         * by the formatter.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   148
         * @return verbosity options
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   149
         */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   150
        public Set<DiagnosticPart> getVisible();
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   151
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   152
        //where
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   153
        /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   154
         * A given diagnostic message can be divided into sub-parts each of which
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   155
         * might/might not be displayed by the formatter, according to the
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   156
         * current configuration settings.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   157
         */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   158
        public enum DiagnosticPart {
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   159
            /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   160
             * Short description of the diagnostic - usually one line long.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   161
             */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   162
            SUMMARY,
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   163
            /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   164
             * Longer description that provides additional details w.r.t. the ones
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   165
             * in the diagnostic's description.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   166
             */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   167
            DETAILS,
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   168
            /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   169
             * Source line the diagnostic refers to (if applicable).
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   170
             */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   171
            SOURCE,
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   172
            /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   173
             * Subdiagnostics attached to a given multiline diagnostic.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   174
             */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   175
            SUBDIAGNOSTICS,
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   176
            /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   177
             * JLS paragraph this diagnostic might refer to (if applicable).
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   178
             */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   179
            JLS;
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   180
        }
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   181
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   182
        /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   183
         * Set a limit for multiline diagnostics.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   184
         * Note: Setting a limit has no effect if multiline diagnostics are either
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   185
         * fully enabled or disabled.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   186
         *
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   187
         * @param limit the kind of limit to be set
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   188
         * @param value the limit value
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   189
         */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   190
        public void setMultilineLimit(MultilineLimit limit, int value);
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   191
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   192
        /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   193
         * Get a multiline diagnostic limit.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   194
         *
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   195
         * @param limit the kind of limit to be retrieved
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   196
         * @return limit value or -1 if no limit is set
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   197
         */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   198
        public int getMultilineLimit(MultilineLimit limit);
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   199
        //where
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   200
        /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   201
         * A multiline limit control the verbosity of multiline diagnostics
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   202
         * either by setting a maximum depth of nested multidiagnostics,
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   203
         * or by limiting the amount of subdiagnostics attached to a given
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   204
         * diagnostic (or both).
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   205
         */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   206
        public enum MultilineLimit {
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   207
            /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   208
             * Controls the maximum depth of nested multiline diagnostics.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   209
             */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   210
            DEPTH,
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   211
            /**
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   212
             * Controls the maximum amount of subdiagnostics that are part of a
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   213
             * given multiline diagnostic.
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   214
             */
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   215
            LENGTH;
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   216
        }
4792e12a8ca2 6769027: Source line should be displayed immediately after the first diagnostic line
mcimadamore
parents: 1109
diff changeset
   217
    }
942
98e1d4f8aacd 6720185: DiagnosticFormatter refactoring
mcimadamore
parents:
diff changeset
   218
}