Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/annotation/processing/Messager.java
38913 views
/*1* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.annotation.processing;2627import javax.annotation.*;28import javax.tools.Diagnostic;29import javax.lang.model.element.*;3031/**32* A {@code Messager} provides the way for an annotation processor to33* report error messages, warnings, and other notices. Elements,34* annotations, and annotation values can be passed to provide a35* location hint for the message. However, such location hints may be36* unavailable or only approximate.37*38* <p>Printing a message with an {@linkplain39* javax.tools.Diagnostic.Kind#ERROR error kind} will {@linkplain40* RoundEnvironment#errorRaised raise an error}.41*42* <p>Note that the messages "printed" by methods in this43* interface may or may not appear as textual output to a location44* like {@link System#out} or {@link System#err}. Implementations may45* choose to present this information in a different fashion, such as46* messages in a window.47*48* @author Joseph D. Darcy49* @author Scott Seligman50* @author Peter von der Ahé51* @see ProcessingEnvironment#getLocale52* @since 1.653*/54public interface Messager {55/**56* Prints a message of the specified kind.57*58* @param kind the kind of message59* @param msg the message, or an empty string if none60*/61void printMessage(Diagnostic.Kind kind, CharSequence msg);6263/**64* Prints a message of the specified kind at the location of the65* element.66*67* @param kind the kind of message68* @param msg the message, or an empty string if none69* @param e the element to use as a position hint70*/71void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e);7273/**74* Prints a message of the specified kind at the location of the75* annotation mirror of the annotated element.76*77* @param kind the kind of message78* @param msg the message, or an empty string if none79* @param e the annotated element80* @param a the annotation to use as a position hint81*/82void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a);8384/**85* Prints a message of the specified kind at the location of the86* annotation value inside the annotation mirror of the annotated87* element.88*89* @param kind the kind of message90* @param msg the message, or an empty string if none91* @param e the annotated element92* @param a the annotation containing the annotation value93* @param v the annotation value to use as a position hint94*/95void printMessage(Diagnostic.Kind kind,96CharSequence msg,97Element e,98AnnotationMirror a,99AnnotationValue v);100}101102103