jjg@46: /* jjg@1358: * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. jjg@46: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@46: * jjg@46: * This code is free software; you can redistribute it and/or modify it jjg@46: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this jjg@46: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. jjg@46: * jjg@46: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@46: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@46: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@46: * version 2 for more details (a copy is included in the LICENSE file that jjg@46: * accompanied this code). jjg@46: * jjg@46: * You should have received a copy of the GNU General Public License version jjg@46: * 2 along with this work; if not, write to the Free Software Foundation, jjg@46: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@46: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. jjg@46: */ jjg@46: jjg@46: package com.sun.tools.javap; //javax.tools; jjg@46: jjg@46: import java.io.Writer; jjg@46: import java.nio.charset.Charset; jjg@46: import java.util.Locale; jjg@46: import java.util.concurrent.Callable; jjg@1358: import javax.tools.Diagnostic; jjg@46: import javax.tools.DiagnosticListener; jjg@46: import javax.tools.JavaFileManager; jjg@46: import javax.tools.JavaFileObject; jjg@46: import javax.tools.OptionChecker; jjg@46: import javax.tools.StandardJavaFileManager; jjg@1358: import javax.tools.StandardLocation; jjg@46: import javax.tools.Tool; jjg@46: jjg@46: /** jjg@46: * This class is intended to be put in javax.tools. jjg@46: * jjg@46: * @see DiagnosticListener jjg@46: * @see Diagnostic jjg@46: * @see JavaFileManager jjg@416: * @since 1.7 jjg@46: * jjg@581: *

This is NOT part of any supported API. jjg@581: * If you write code that depends on this, you do so at your own risk. jjg@46: * This code and its internal interfaces are subject to change or jjg@46: * deletion without notice. jjg@46: */ jjg@46: public interface DisassemblerTool extends Tool, OptionChecker { jjg@46: jjg@46: /** jjg@46: * Creates a future for a disassembly task with the given jjg@46: * components and arguments. The task might not have jjg@46: * completed as described in the DissemblerTask interface. jjg@46: * jjg@46: *

If a file manager is provided, it must be able to handle all jjg@46: * locations defined in {@link StandardLocation}. jjg@46: * jjg@46: * @param out a Writer for additional output from the compiler; jjg@46: * use {@code System.err} if {@code null} jjg@46: * @param fileManager a file manager; if {@code null} use the jjg@46: * compiler's standard filemanager jjg@46: * @param diagnosticListener a diagnostic listener; if {@code jjg@46: * null} use the compiler's default method for reporting jjg@46: * diagnostics jjg@46: * @param options compiler options, {@code null} means no options jjg@46: * @param classes class names (for annotation processing), {@code jjg@46: * null} means no class names jjg@1358: * @return a task to perform the disassembly jjg@46: * @throws RuntimeException if an unrecoverable error jjg@46: * occurred in a user supplied component. The jjg@46: * {@linkplain Throwable#getCause() cause} will be the error in jjg@46: * user code. jjg@46: * @throws IllegalArgumentException if any of the given jjg@46: * compilation units are of other kind than jjg@46: * {@linkplain JavaFileObject.Kind#SOURCE source} jjg@46: */ jjg@46: DisassemblerTask getTask(Writer out, jjg@46: JavaFileManager fileManager, jjg@46: DiagnosticListener diagnosticListener, jjg@46: Iterable options, jjg@46: Iterable classes); jjg@46: jjg@46: /** jjg@46: * Gets a new instance of the standard file manager implementation jjg@46: * for this tool. The file manager will use the given diagnostic jjg@46: * listener for producing any non-fatal diagnostics. Fatal errors jjg@46: * will be signalled with the appropriate exceptions. jjg@46: * jjg@46: *

The standard file manager will be automatically reopened if jjg@46: * it is accessed after calls to {@code flush} or {@code close}. jjg@46: * The standard file manager must be usable with other tools. jjg@46: * jjg@46: * @param diagnosticListener a diagnostic listener for non-fatal jjg@46: * diagnostics; if {@code null} use the compiler's default method jjg@46: * for reporting diagnostics jjg@46: * @param locale the locale to apply when formatting diagnostics; jjg@46: * {@code null} means the {@linkplain Locale#getDefault() default locale}. jjg@46: * @param charset the character set used for decoding bytes; if jjg@46: * {@code null} use the platform default jjg@46: * @return the standard file manager jjg@46: */ jjg@46: StandardJavaFileManager getStandardFileManager( jjg@46: DiagnosticListener diagnosticListener, jjg@46: Locale locale, jjg@46: Charset charset); jjg@46: jjg@46: /** jjg@46: * Interface representing a future for a disassembly task. The jjg@46: * task has not yet started. To start the task, call jjg@46: * the {@linkplain #call call} method. jjg@46: * jjg@46: *

Before calling the call method, additional aspects of the jjg@46: * task can be configured, for example, by calling the jjg@46: * {@linkplain #setLocale setLocale} method. jjg@46: */ jjg@46: interface DisassemblerTask extends Callable { jjg@46: jjg@46: /** jjg@46: * Set the locale to be applied when formatting diagnostics and jjg@46: * other localized data. jjg@46: * jjg@46: * @param locale the locale to apply; {@code null} means apply no jjg@46: * locale jjg@46: * @throws IllegalStateException if the task has started jjg@46: */ jjg@46: void setLocale(Locale locale); jjg@46: jjg@46: /** jjg@46: * Performs this compilation task. The compilation may only jjg@46: * be performed once. Subsequent calls to this method throw jjg@46: * IllegalStateException. jjg@46: * jjg@46: * @return true if and only all the files compiled without errors; jjg@46: * false otherwise jjg@46: * jjg@46: * @throws RuntimeException if an unrecoverable error occurred jjg@46: * in a user-supplied component. The jjg@46: * {@linkplain Throwable#getCause() cause} will be the error jjg@46: * in user code. jjg@46: * @throws IllegalStateException if called more than once jjg@46: */ jjg@46: Boolean call(); jjg@46: } jjg@46: }