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

Tue, 28 Dec 2010 15:54:52 -0800

author
ohair
date
Tue, 28 Dec 2010 15:54:52 -0800
changeset 798
4868a36f6fd8
parent 581
f2fdd52e4e87
child 1358
fc123bdeddb8
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

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

mercurial