src/share/classes/com/sun/tools/javap/DisassemblerTool.java

changeset 46
7708bd6d800d
child 54
eaf608c64fec
equal deleted inserted replaced
42:f7e64b33d5a4 46:7708bd6d800d
1 /*
2 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
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
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
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 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package com.sun.tools.javap; //javax.tools;
27
28 import java.io.Writer;
29 import java.nio.charset.Charset;
30 import java.util.Locale;
31 import java.util.concurrent.Callable;
32 import javax.tools.DiagnosticListener;
33 import javax.tools.JavaFileManager;
34 import javax.tools.JavaFileObject;
35 import javax.tools.OptionChecker;
36 import javax.tools.StandardJavaFileManager;
37 import javax.tools.Tool;
38
39 /**
40 * This class is intended to be put in javax.tools.
41 *
42 * @see DiagnosticListener
43 * @see Diagnostic
44 * @see JavaFileManager
45 * @since 1.6
46 *
47 * <p><b>This is NOT part of any API supported by Sun Microsystems. If
48 * you write code that depends on this, you do so at your own risk.
49 * This code and its internal interfaces are subject to change or
50 * deletion without notice.</b>
51 */
52 public interface DisassemblerTool extends Tool, OptionChecker {
53
54 /**
55 * Creates a future for a disassembly task with the given
56 * components and arguments. The task might not have
57 * completed as described in the DissemblerTask interface.
58 *
59 * <p>If a file manager is provided, it must be able to handle all
60 * locations defined in {@link StandardLocation}.
61 *
62 * @param out a Writer for additional output from the compiler;
63 * use {@code System.err} if {@code null}
64 * @param fileManager a file manager; if {@code null} use the
65 * compiler's standard filemanager
66 * @param diagnosticListener a diagnostic listener; if {@code
67 * null} use the compiler's default method for reporting
68 * diagnostics
69 * @param options compiler options, {@code null} means no options
70 * @param classes class names (for annotation processing), {@code
71 * null} means no class names
72 * @param compilationUnits the compilation units to compile, {@code
73 * null} means no compilation units
74 * @return an object representing the compilation
75 * @throws RuntimeException if an unrecoverable error
76 * occurred in a user supplied component. The
77 * {@linkplain Throwable#getCause() cause} will be the error in
78 * user code.
79 * @throws IllegalArgumentException if any of the given
80 * compilation units are of other kind than
81 * {@linkplain JavaFileObject.Kind#SOURCE source}
82 */
83 DisassemblerTask getTask(Writer out,
84 JavaFileManager fileManager,
85 DiagnosticListener<? super JavaFileObject> diagnosticListener,
86 Iterable<String> options,
87 Iterable<String> classes);
88
89 /**
90 * Gets a new instance of the standard file manager implementation
91 * for this tool. The file manager will use the given diagnostic
92 * listener for producing any non-fatal diagnostics. Fatal errors
93 * will be signalled with the appropriate exceptions.
94 *
95 * <p>The standard file manager will be automatically reopened if
96 * it is accessed after calls to {@code flush} or {@code close}.
97 * The standard file manager must be usable with other tools.
98 *
99 * @param diagnosticListener a diagnostic listener for non-fatal
100 * diagnostics; if {@code null} use the compiler's default method
101 * for reporting diagnostics
102 * @param locale the locale to apply when formatting diagnostics;
103 * {@code null} means the {@linkplain Locale#getDefault() default locale}.
104 * @param charset the character set used for decoding bytes; if
105 * {@code null} use the platform default
106 * @return the standard file manager
107 */
108 StandardJavaFileManager getStandardFileManager(
109 DiagnosticListener<? super JavaFileObject> diagnosticListener,
110 Locale locale,
111 Charset charset);
112
113 /**
114 * Interface representing a future for a disassembly task. The
115 * task has not yet started. To start the task, call
116 * the {@linkplain #call call} method.
117 *
118 * <p>Before calling the call method, additional aspects of the
119 * task can be configured, for example, by calling the
120 * {@linkplain #setLocale setLocale} method.
121 */
122 interface DisassemblerTask extends Callable<Boolean> {
123
124 /**
125 * Set the locale to be applied when formatting diagnostics and
126 * other localized data.
127 *
128 * @param locale the locale to apply; {@code null} means apply no
129 * locale
130 * @throws IllegalStateException if the task has started
131 */
132 void setLocale(Locale locale);
133
134 /**
135 * Performs this compilation task. The compilation may only
136 * be performed once. Subsequent calls to this method throw
137 * IllegalStateException.
138 *
139 * @return true if and only all the files compiled without errors;
140 * false otherwise
141 *
142 * @throws RuntimeException if an unrecoverable error occurred
143 * in a user-supplied component. The
144 * {@linkplain Throwable#getCause() cause} will be the error
145 * in user code.
146 * @throws IllegalStateException if called more than once
147 */
148 Boolean call();
149 }
150 }

mercurial