Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/com/sun/source/util/TaskEvent.java
38899 views
/*1* Copyright (c) 2005, 2013, 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 com.sun.source.util;2627import javax.lang.model.element.TypeElement;28import javax.tools.JavaFileObject;2930import com.sun.source.tree.CompilationUnitTree;3132/**33* Provides details about work that has been done by the JDK Java Compiler, javac.34*35* @author Jonathan Gibbons36* @since 1.637*/38@jdk.Exported39public final class TaskEvent40{41/**42* Kind of task event.43* @since 1.644*/45@jdk.Exported46public enum Kind {47/**48* For events related to the parsing of a file.49*/50PARSE,51/**52* For events relating to elements being entered.53**/54ENTER,55/**56* For events relating to elements being analyzed for errors.57**/58ANALYZE,59/**60* For events relating to class files being generated.61**/62GENERATE,63/**64* For events relating to overall annotation processing.65**/66ANNOTATION_PROCESSING,67/**68* For events relating to an individual annotation processing round.69**/70ANNOTATION_PROCESSING_ROUND71};7273public TaskEvent(Kind kind) {74this(kind, null, null, null);75}7677public TaskEvent(Kind kind, JavaFileObject sourceFile) {78this(kind, sourceFile, null, null);79}8081public TaskEvent(Kind kind, CompilationUnitTree unit) {82this(kind, unit.getSourceFile(), unit, null);83}8485public TaskEvent(Kind kind, CompilationUnitTree unit, TypeElement clazz) {86this(kind, unit.getSourceFile(), unit, clazz);87}8889private TaskEvent(Kind kind, JavaFileObject file, CompilationUnitTree unit, TypeElement clazz) {90this.kind = kind;91this.file = file;92this.unit = unit;93this.clazz = clazz;94}9596public Kind getKind() {97return kind;98}99100public JavaFileObject getSourceFile() {101return file;102}103104public CompilationUnitTree getCompilationUnit() {105return unit;106}107108public TypeElement getTypeElement() {109return clazz;110}111112public String toString() {113return "TaskEvent["114+ kind + ","115+ file + ","116// the compilation unit is identified by the file117+ clazz + "]";118}119120private Kind kind;121private JavaFileObject file;122private CompilationUnitTree unit;123private TypeElement clazz;124}125126127