author | jjg |
Thu, 10 Jun 2010 17:09:56 -0700 | |
changeset 5848 | c5a4ce47e780 |
parent 5520 | 86e4b9a9da40 |
child 14258 | 8d2148961366 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
5520 | 2 |
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.source.util; |
|
27 |
||
28 |
import com.sun.source.tree.CompilationUnitTree; |
|
29 |
import javax.lang.model.element.TypeElement; |
|
30 |
import javax.tools.JavaFileObject; |
|
31 |
||
32 |
/** |
|
5848
c5a4ce47e780
6960407: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
33 |
* Provides details about work that has been done by the JDK Java Compiler, javac. |
10 | 34 |
* |
35 |
* @author Jonathan Gibbons |
|
36 |
* @since 1.6 |
|
37 |
*/ |
|
38 |
public final class TaskEvent |
|
39 |
{ |
|
40 |
/** |
|
41 |
* Kind of task event. |
|
42 |
* @since 1.6 |
|
43 |
*/ |
|
44 |
public enum Kind { |
|
45 |
/** |
|
46 |
* For events related to the parsing of a file. |
|
47 |
*/ |
|
48 |
PARSE, |
|
49 |
/** |
|
50 |
* For events relating to elements being entered. |
|
51 |
**/ |
|
52 |
ENTER, |
|
53 |
/** |
|
54 |
* For events relating to elements being analyzed for errors. |
|
55 |
**/ |
|
56 |
ANALYZE, |
|
57 |
/** |
|
58 |
* For events relating to class files being generated. |
|
59 |
**/ |
|
60 |
GENERATE, |
|
61 |
/** |
|
62 |
* For events relating to overall annotaion processing. |
|
63 |
**/ |
|
64 |
ANNOTATION_PROCESSING, |
|
65 |
/** |
|
66 |
* For events relating to an individual annotation processing round. |
|
67 |
**/ |
|
68 |
ANNOTATION_PROCESSING_ROUND |
|
69 |
}; |
|
70 |
||
71 |
public TaskEvent(Kind kind) { |
|
72 |
this(kind, null, null, null); |
|
73 |
} |
|
74 |
||
75 |
public TaskEvent(Kind kind, JavaFileObject sourceFile) { |
|
76 |
this(kind, sourceFile, null, null); |
|
77 |
} |
|
78 |
||
79 |
public TaskEvent(Kind kind, CompilationUnitTree unit) { |
|
80 |
this(kind, unit.getSourceFile(), unit, null); |
|
81 |
} |
|
82 |
||
83 |
public TaskEvent(Kind kind, CompilationUnitTree unit, TypeElement clazz) { |
|
84 |
this(kind, unit.getSourceFile(), unit, clazz); |
|
85 |
} |
|
86 |
||
87 |
private TaskEvent(Kind kind, JavaFileObject file, CompilationUnitTree unit, TypeElement clazz) { |
|
88 |
this.kind = kind; |
|
89 |
this.file = file; |
|
90 |
this.unit = unit; |
|
91 |
this.clazz = clazz; |
|
92 |
} |
|
93 |
||
94 |
public Kind getKind() { |
|
95 |
return kind; |
|
96 |
} |
|
97 |
||
98 |
public JavaFileObject getSourceFile() { |
|
99 |
return file; |
|
100 |
} |
|
101 |
||
102 |
public CompilationUnitTree getCompilationUnit() { |
|
103 |
return unit; |
|
104 |
} |
|
105 |
||
106 |
public TypeElement getTypeElement() { |
|
107 |
return clazz; |
|
108 |
} |
|
109 |
||
110 |
public String toString() { |
|
111 |
return "TaskEvent[" |
|
112 |
+ kind + "," |
|
113 |
+ file + "," |
|
114 |
// the compilation unit is identified by the file |
|
115 |
+ clazz + "]"; |
|
116 |
} |
|
117 |
||
118 |
private Kind kind; |
|
119 |
private JavaFileObject file; |
|
120 |
private CompilationUnitTree unit; |
|
121 |
private TypeElement clazz; |
|
122 |
} |