src/share/classes/javax/annotation/processing/Messager.java

changeset 1
9a66ca7c79fa
child 554
9d9f26857129
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/javax/annotation/processing/Messager.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,101 @@
     1.4 +/*
     1.5 + * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Sun designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Sun in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 + * have any questions.
    1.27 + */
    1.28 +
    1.29 +package javax.annotation.processing;
    1.30 +
    1.31 +import javax.annotation.*;
    1.32 +import javax.tools.Diagnostic;
    1.33 +import javax.lang.model.element.*;
    1.34 +
    1.35 +/**
    1.36 + * A {@code Messager} provides the way for an annotation processor to
    1.37 + * report error messages, warnings, and other notices.  Elements,
    1.38 + * annotations, and annotation values can be passed to provide a
    1.39 + * location hint for the message.  However, such location hints may be
    1.40 + * unavailable or only approximate.
    1.41 + *
    1.42 + * <p>Printing a message with an {@linkplain
    1.43 + * javax.tools.Diagnostic.Kind#ERROR error kind} will {@linkplain
    1.44 + * RoundEnvironment#errorRaised raise an error}.
    1.45 + *
    1.46 + * <p>Note that the messages &quot;printed&quot; by methods in this
    1.47 + * interface may or may not appear as textual output to a location
    1.48 + * like {@link System#out} or {@link System#err}.  Implementations may
    1.49 + * choose to present this information in a different fashion, such as
    1.50 + * messages in a window.
    1.51 + *
    1.52 + * @author Joseph D. Darcy
    1.53 + * @author Scott Seligman
    1.54 + * @author Peter von der Ah&eacute;
    1.55 + * @see ProcessingEnvironment#getLocale
    1.56 + * @since 1.6
    1.57 + */
    1.58 +public interface Messager {
    1.59 +    /**
    1.60 +     * Prints a message of the specified kind.
    1.61 +     *
    1.62 +     * @param kind the kind of message
    1.63 +     * @param msg  the message, or an empty string if none
    1.64 +     */
    1.65 +    void printMessage(Diagnostic.Kind kind, CharSequence msg);
    1.66 +
    1.67 +    /**
    1.68 +     * Prints a message of the specified kind at the location of the
    1.69 +     * element.
    1.70 +     *
    1.71 +     * @param kind the kind of message
    1.72 +     * @param msg  the message, or an empty string if none
    1.73 +     * @param e    the element to use as a position hint
    1.74 +     */
    1.75 +    void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e);
    1.76 +
    1.77 +    /**
    1.78 +     * Prints a message of the specified kind at the location of the
    1.79 +     * annotation mirror of the annotated element.
    1.80 +     *
    1.81 +     * @param kind the kind of message
    1.82 +     * @param msg  the message, or an empty string if none
    1.83 +     * @param e    the annotated element
    1.84 +     * @param a    the annotation to use as a position hint
    1.85 +     */
    1.86 +    void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a);
    1.87 +
    1.88 +    /**
    1.89 +     * Prints a message of the specified kind at the location of the
    1.90 +     * annotation value inside the annotation mirror of the annotated
    1.91 +     * element.
    1.92 +     *
    1.93 +     * @param kind the kind of message
    1.94 +     * @param msg  the message, or an empty string if none
    1.95 +     * @param e    the annotated element
    1.96 +     * @param a    the annotation containing the annotation value
    1.97 +     * @param v    the annotation value to use as a position hint
    1.98 +     */
    1.99 +    void printMessage(Diagnostic.Kind kind,
   1.100 +                      CharSequence msg,
   1.101 +                      Element e,
   1.102 +                      AnnotationMirror a,
   1.103 +                      AnnotationValue v);
   1.104 +}

mercurial