aoqi@0: /* aoqi@0: * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: package javax.annotation.processing; aoqi@0: aoqi@0: import javax.annotation.*; aoqi@0: import javax.tools.Diagnostic; aoqi@0: import javax.lang.model.element.*; aoqi@0: aoqi@0: /** aoqi@0: * A {@code Messager} provides the way for an annotation processor to aoqi@0: * report error messages, warnings, and other notices. Elements, aoqi@0: * annotations, and annotation values can be passed to provide a aoqi@0: * location hint for the message. However, such location hints may be aoqi@0: * unavailable or only approximate. aoqi@0: * aoqi@0: *

Printing a message with an {@linkplain aoqi@0: * javax.tools.Diagnostic.Kind#ERROR error kind} will {@linkplain aoqi@0: * RoundEnvironment#errorRaised raise an error}. aoqi@0: * aoqi@0: *

Note that the messages "printed" by methods in this aoqi@0: * interface may or may not appear as textual output to a location aoqi@0: * like {@link System#out} or {@link System#err}. Implementations may aoqi@0: * choose to present this information in a different fashion, such as aoqi@0: * messages in a window. aoqi@0: * aoqi@0: * @author Joseph D. Darcy aoqi@0: * @author Scott Seligman aoqi@0: * @author Peter von der Ahé aoqi@0: * @see ProcessingEnvironment#getLocale aoqi@0: * @since 1.6 aoqi@0: */ aoqi@0: public interface Messager { aoqi@0: /** aoqi@0: * Prints a message of the specified kind. aoqi@0: * aoqi@0: * @param kind the kind of message aoqi@0: * @param msg the message, or an empty string if none aoqi@0: */ aoqi@0: void printMessage(Diagnostic.Kind kind, CharSequence msg); aoqi@0: aoqi@0: /** aoqi@0: * Prints a message of the specified kind at the location of the aoqi@0: * element. aoqi@0: * aoqi@0: * @param kind the kind of message aoqi@0: * @param msg the message, or an empty string if none aoqi@0: * @param e the element to use as a position hint aoqi@0: */ aoqi@0: void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e); aoqi@0: aoqi@0: /** aoqi@0: * Prints a message of the specified kind at the location of the aoqi@0: * annotation mirror of the annotated element. aoqi@0: * aoqi@0: * @param kind the kind of message aoqi@0: * @param msg the message, or an empty string if none aoqi@0: * @param e the annotated element aoqi@0: * @param a the annotation to use as a position hint aoqi@0: */ aoqi@0: void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a); aoqi@0: aoqi@0: /** aoqi@0: * Prints a message of the specified kind at the location of the aoqi@0: * annotation value inside the annotation mirror of the annotated aoqi@0: * element. aoqi@0: * aoqi@0: * @param kind the kind of message aoqi@0: * @param msg the message, or an empty string if none aoqi@0: * @param e the annotated element aoqi@0: * @param a the annotation containing the annotation value aoqi@0: * @param v the annotation value to use as a position hint aoqi@0: */ aoqi@0: void printMessage(Diagnostic.Kind kind, aoqi@0: CharSequence msg, aoqi@0: Element e, aoqi@0: AnnotationMirror a, aoqi@0: AnnotationValue v); aoqi@0: }