Path: blob/master/src/jdk.jdeps/share/classes/com/sun/tools/javap/DisassemblerTool.java
58461 views
/*1* Copyright (c) 2005, 2014, 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.tools.javap; //javax.tools;2627import java.io.Writer;28import java.nio.charset.Charset;29import java.util.Locale;30import java.util.concurrent.Callable;31import javax.tools.Diagnostic;32import javax.tools.DiagnosticListener;33import javax.tools.JavaFileManager;34import javax.tools.JavaFileObject;35import javax.tools.OptionChecker;36import javax.tools.StandardJavaFileManager;37import javax.tools.StandardLocation;38import javax.tools.Tool;3940/**41* This class is intended to be put in javax.tools.42*43* @see DiagnosticListener44* @see Diagnostic45* @see JavaFileManager46* @since 1.747*48* <p><b>This is NOT part of any supported API.49* If you write code that depends on this, you do so at your own risk.50* This code and its internal interfaces are subject to change or51* deletion without notice.</b>52*/53public interface DisassemblerTool extends Tool, OptionChecker {5455/**56* Creates a future for a disassembly task with the given57* components and arguments. The task might not have58* completed as described in the DissemblerTask interface.59*60* <p>If a file manager is provided, it must be able to handle all61* locations defined in {@link StandardLocation}.62*63* @param out a Writer for additional output from the compiler;64* use {@code System.err} if {@code null}65* @param fileManager a file manager; if {@code null} use the66* compiler's standard filemanager67* @param diagnosticListener a diagnostic listener; if {@code68* null} use the compiler's default method for reporting69* diagnostics70* @param options compiler options, {@code null} means no options71* @param classes class names (for annotation processing), {@code72* null} means no class names73* @return a task to perform the disassembly74* @throws RuntimeException if an unrecoverable error75* occurred in a user supplied component. The76* {@linkplain Throwable#getCause() cause} will be the error in77* user code.78* @throws IllegalArgumentException if any of the given79* compilation units are of other kind than80* {@linkplain JavaFileObject.Kind#SOURCE source}81*/82DisassemblerTask getTask(Writer out,83JavaFileManager fileManager,84DiagnosticListener<? super JavaFileObject> diagnosticListener,85Iterable<String> options,86Iterable<String> classes);8788/**89* Returns a new instance of the standard file manager implementation90* for this tool. The file manager will use the given diagnostic91* listener for producing any non-fatal diagnostics. Fatal errors92* will be signalled with the appropriate exceptions.93*94* <p>The standard file manager will be automatically reopened if95* it is accessed after calls to {@code flush} or {@code close}.96* The standard file manager must be usable with other tools.97*98* @param diagnosticListener a diagnostic listener for non-fatal99* diagnostics; if {@code null} use the compiler's default method100* for reporting diagnostics101* @param locale the locale to apply when formatting diagnostics;102* {@code null} means the {@linkplain Locale#getDefault() default locale}.103* @param charset the character set used for decoding bytes; if104* {@code null} use the platform default105* @return the standard file manager106*/107StandardJavaFileManager getStandardFileManager(108DiagnosticListener<? super JavaFileObject> diagnosticListener,109Locale locale,110Charset charset);111112/**113* Interface representing a future for a disassembly task. The114* task has not yet started. To start the task, call115* the {@linkplain #call call} method.116*117* <p>Before calling the call method, additional aspects of the118* task can be configured, for example, by calling the119* {@linkplain #setLocale setLocale} method.120*/121interface DisassemblerTask extends Callable<Boolean> {122123/**124* Set the locale to be applied when formatting diagnostics and125* other localized data.126*127* @param locale the locale to apply; {@code null} means apply no128* locale129* @throws IllegalStateException if the task has started130*/131void setLocale(Locale locale);132133/**134* Performs this compilation task. The compilation may only135* be performed once. Subsequent calls to this method throw136* IllegalStateException.137*138* @return true if and only all the files compiled without errors;139* false otherwise140*141* @throws RuntimeException if an unrecoverable error occurred142* in a user-supplied component. The143* {@linkplain Throwable#getCause() cause} will be the error144* in user code.145* @throws IllegalStateException if called more than once146*/147Boolean call();148}149}150151152