src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java

Thu, 29 Jan 2009 12:19:14 +0000

author
mcimadamore
date
Thu, 29 Jan 2009 12:19:14 +0000
changeset 212
79f2f2c7d846
parent 100
37551dc0f591
child 221
6ada6122dd4f
permissions
-rw-r--r--

6729401: Compiler error when using F-bounded generics with free type variables
Summary: Javac applies wrong substitution to recursive type-variable bounds
Reviewed-by: jjg

mcimadamore@83 1 /*
mcimadamore@83 2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@83 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@83 4 *
mcimadamore@83 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@83 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@83 7 * published by the Free Software Foundation. Sun designates this
mcimadamore@83 8 * particular file as subject to the "Classpath" exception as provided
mcimadamore@83 9 * by Sun in the LICENSE file that accompanied this code.
mcimadamore@83 10 *
mcimadamore@83 11 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@83 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@83 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@83 14 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@83 15 * accompanied this code).
mcimadamore@83 16 *
mcimadamore@83 17 * You should have received a copy of the GNU General Public License version
mcimadamore@83 18 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@83 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@83 20 *
mcimadamore@83 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@83 22 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@83 23 * have any questions.
mcimadamore@83 24 */
mcimadamore@83 25 package com.sun.tools.javac.api;
mcimadamore@83 26
mcimadamore@83 27 import java.util.Locale;
mcimadamore@83 28 import javax.tools.Diagnostic;
mcimadamore@83 29
mcimadamore@83 30 /**
mcimadamore@83 31 * Provides simple functionalities for javac diagnostic formatting
mcimadamore@83 32 * @param <D> type of diagnostic handled by this formatter
mcimadamore@83 33 */
mcimadamore@83 34 public interface DiagnosticFormatter<D extends Diagnostic<?>> {
mcimadamore@83 35
mcimadamore@83 36 /**
mcimadamore@83 37 * Whether the source code output for this diagnostic is to be displayed
mcimadamore@83 38 *
mcimadamore@83 39 * @param diag diagnostic to be formatted
mcimadamore@83 40 * @return true if the source line this diagnostic refers to is to be displayed
mcimadamore@83 41 */
mcimadamore@83 42 boolean displaySource(D diag);
mcimadamore@83 43
mcimadamore@83 44 /**
mcimadamore@83 45 * Format the contents of a diagnostics
mcimadamore@83 46 *
mcimadamore@83 47 * @param diag the diagnostic to be formatted
mcimadamore@83 48 * @param l locale object to be used for i18n
mcimadamore@83 49 * @return a string representing the diagnostic
mcimadamore@83 50 */
mcimadamore@83 51 public String format(D diag, Locale l);
mcimadamore@83 52
mcimadamore@83 53 /**
mcimadamore@83 54 * Controls the way in which a diagnostic message is displayed.
mcimadamore@83 55 *
mcimadamore@83 56 * @param diag diagnostic to be formatted
mcimadamore@83 57 * @param l locale object to be used for i18n
mcimadamore@83 58 * @return string representation of the diagnostic message
mcimadamore@83 59 */
mcimadamore@83 60 public String formatMessage(D diag,Locale l);
mcimadamore@83 61
mcimadamore@83 62 /**
mcimadamore@83 63 * Controls the way in which a diagnostic kind is displayed.
mcimadamore@83 64 *
mcimadamore@83 65 * @param diag diagnostic to be formatted
mcimadamore@83 66 * @param l locale object to be used for i18n
mcimadamore@83 67 * @return string representation of the diagnostic prefix
mcimadamore@83 68 */
mcimadamore@83 69 public String formatKind(D diag, Locale l);
mcimadamore@83 70
mcimadamore@83 71 /**
mcimadamore@83 72 * Controls the way in which a diagnostic source is displayed.
mcimadamore@83 73 *
mcimadamore@83 74 * @param diag diagnostic to be formatted
mcimadamore@83 75 * @param l locale object to be used for i18n
mcimadamore@100 76 * @param fullname whether the source fullname should be printed
mcimadamore@83 77 * @return string representation of the diagnostic source
mcimadamore@83 78 */
mcimadamore@100 79 public String formatSource(D diag, boolean fullname, Locale l);
mcimadamore@83 80
mcimadamore@83 81 /**
mcimadamore@83 82 * Controls the way in which a diagnostic position is displayed.
mcimadamore@83 83 *
mcimadamore@83 84 * @param diag diagnostic to be formatted
mcimadamore@83 85 * @param pk enum constant representing the position kind
mcimadamore@83 86 * @param l locale object to be used for i18n
mcimadamore@83 87 * @return string representation of the diagnostic position
mcimadamore@83 88 */
mcimadamore@83 89 public String formatPosition(D diag, PositionKind pk, Locale l);
mcimadamore@83 90 //where
mcimadamore@83 91 /**
mcimadamore@83 92 * This enum defines a set of constants for all the kinds of position
mcimadamore@83 93 * that a diagnostic can be asked for. All positions are intended to be
mcimadamore@83 94 * relative to a given diagnostic source.
mcimadamore@83 95 */
mcimadamore@83 96 public enum PositionKind {
mcimadamore@83 97 /**
mcimadamore@83 98 * Start position
mcimadamore@83 99 */
mcimadamore@83 100 START,
mcimadamore@83 101 /**
mcimadamore@83 102 * End position
mcimadamore@83 103 */
mcimadamore@83 104 END,
mcimadamore@83 105 /**
mcimadamore@83 106 * Line number
mcimadamore@83 107 */
mcimadamore@83 108 LINE,
mcimadamore@83 109 /**
mcimadamore@83 110 * Column number
mcimadamore@83 111 */
mcimadamore@83 112 COLUMN,
mcimadamore@83 113 /**
mcimadamore@83 114 * Offset position
mcimadamore@83 115 */
mcimadamore@83 116 OFFSET
mcimadamore@83 117 }
mcimadamore@83 118 }

mercurial