author | jjg |
Thu, 10 Jun 2010 16:08:01 -0700 | |
changeset 5847 | 1908176fd6e3 |
parent 5520 | 86e4b9a9da40 |
child 14259 | fb94a1df0d53 |
permissions | -rw-r--r-- |
3996
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
1 |
/* |
5520 | 2 |
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. |
3996
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
4 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
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 |
3996
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
3996
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
10 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
15 |
* accompanied this code). |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
16 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
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. |
|
3996
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
24 |
*/ |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
25 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
26 |
package com.sun.tools.javah; //javax.tools; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
27 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
28 |
import java.io.Writer; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
29 |
import java.nio.charset.Charset; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
30 |
import java.util.Locale; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
31 |
import java.util.concurrent.Callable; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
32 |
import javax.tools.DiagnosticListener; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
33 |
import javax.tools.JavaFileManager; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
34 |
import javax.tools.JavaFileObject; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
35 |
import javax.tools.OptionChecker; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
36 |
import javax.tools.StandardJavaFileManager; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
37 |
import javax.tools.Tool; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
38 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
39 |
/** |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
40 |
* This class is intended to be put in javax.tools. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
41 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
42 |
* @see DiagnosticListener |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
43 |
* @see Diagnostic |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
44 |
* @see JavaFileManager |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
45 |
* @since 1.7 |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
46 |
* |
5847
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
47 |
* <p><b>This is NOT part of any supported API. |
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
48 |
* If you write code that depends on this, you do so at your own risk. |
3996
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
49 |
* This code and its internal interfaces are subject to change or |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
50 |
* deletion without notice.</b> |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
51 |
*/ |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
52 |
public interface NativeHeaderTool extends Tool, OptionChecker { |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
53 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
54 |
/** |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
55 |
* Creates a future for a native header task with the given |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
56 |
* components and arguments. The task might not have |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
57 |
* completed as described in the NativeHeaderTask interface. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
58 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
59 |
* <p>If a file manager is provided, it must be able to handle all |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
60 |
* locations defined in {@link StandardLocation}. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
61 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
62 |
* @param out a Writer for additional output from the task; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
63 |
* use {@code System.err} if {@code null} |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
64 |
* @param fileManager a file manager; if {@code null} use the |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
65 |
* task's standard filemanager |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
66 |
* @param diagnosticListener a diagnostic listener; if {@code |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
67 |
* null} use the compiler's default method for reporting |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
68 |
* diagnostics |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
69 |
* @param options task options, {@code null} means no options |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
70 |
* @param classes class names for which native headers should be generated |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
71 |
* @return an object representing the task to be done |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
72 |
* @throws RuntimeException if an unrecoverable error |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
73 |
* occurred in a user supplied component. The |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
74 |
* {@linkplain Throwable#getCause() cause} will be the error in |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
75 |
* user code. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
76 |
* @throws IllegalArgumentException if any of the given |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
77 |
* compilation units are of other kind than |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
78 |
* {@linkplain JavaFileObject.Kind#SOURCE source} |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
79 |
*/ |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
80 |
NativeHeaderTask getTask(Writer out, |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
81 |
JavaFileManager fileManager, |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
82 |
DiagnosticListener<? super JavaFileObject> diagnosticListener, |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
83 |
Iterable<String> options, |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
84 |
Iterable<String> classes); |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
85 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
86 |
/** |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
87 |
* Gets a new instance of the standard file manager implementation |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
88 |
* for this tool. The file manager will use the given diagnostic |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
89 |
* listener for producing any non-fatal diagnostics. Fatal errors |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
90 |
* will be signalled with the appropriate exceptions. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
91 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
92 |
* <p>The standard file manager will be automatically reopened if |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
93 |
* it is accessed after calls to {@code flush} or {@code close}. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
94 |
* The standard file manager must be usable with other tools. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
95 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
96 |
* @param diagnosticListener a diagnostic listener for non-fatal |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
97 |
* diagnostics; if {@code null} use the tool's default method |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
98 |
* for reporting diagnostics |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
99 |
* @param locale the locale to apply when formatting diagnostics; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
100 |
* {@code null} means the {@linkplain Locale#getDefault() default locale}. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
101 |
* @param charset the character set used for decoding bytes; if |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
102 |
* {@code null} use the platform default |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
103 |
* @return the standard file manager |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
104 |
*/ |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
105 |
StandardJavaFileManager getStandardFileManager( |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
106 |
DiagnosticListener<? super JavaFileObject> diagnosticListener, |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
107 |
Locale locale, |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
108 |
Charset charset); |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
109 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
110 |
/** |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
111 |
* Interface representing a future for a native header task. The |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
112 |
* task has not yet started. To start the task, call |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
113 |
* the {@linkplain #call call} method. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
114 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
115 |
* <p>Before calling the call method, additional aspects of the |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
116 |
* task can be configured, for example, by calling the |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
117 |
* {@linkplain #setLocale setLocale} method. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
118 |
*/ |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
119 |
interface NativeHeaderTask extends Callable<Boolean> { |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
120 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
121 |
/** |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
122 |
* Set the locale to be applied when formatting diagnostics and |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
123 |
* other localized data. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
124 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
125 |
* @param locale the locale to apply; {@code null} means apply no |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
126 |
* locale |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
127 |
* @throws IllegalStateException if the task has started |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
128 |
*/ |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
129 |
void setLocale(Locale locale); |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
130 |
|
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
131 |
/** |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
132 |
* Performs this native header task. The task may only |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
133 |
* be performed once. Subsequent calls to this method throw |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
134 |
* IllegalStateException. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
135 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
136 |
* @return true if and only all the files were processed without errors; |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
137 |
* false otherwise |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
138 |
* |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
139 |
* @throws RuntimeException if an unrecoverable error occurred |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
140 |
* in a user-supplied component. The |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
141 |
* {@linkplain Throwable#getCause() cause} will be the error |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
142 |
* in user code. |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
143 |
* @throws IllegalStateException if called more than once |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
144 |
*/ |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
145 |
Boolean call(); |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
146 |
} |
dc676a9093b3
6572945: javah should be written as an annotation processor, not a doclet
jjg
parents:
diff
changeset
|
147 |
} |