Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/tools/Tool.java
38900 views
/*1* Copyright (c) 2005, 2006, 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 javax.tools;2627import java.util.Set;28import java.io.InputStream;29import java.io.OutputStream;30import javax.lang.model.SourceVersion;3132/**33* Common interface for tools that can be invoked from a program.34* A tool is traditionally a command line program such as a compiler.35* The set of tools available with a platform is defined by the36* vendor.37*38* <p>Tools can be located using {@link39* java.util.ServiceLoader#load(Class)}.40*41* @author Neal M Gafter42* @author Peter von der Ahé43* @author Jonathan Gibbons44* @since 1.645*/46public interface Tool {4748/**49* Run the tool with the given I/O channels and arguments. By50* convention a tool returns 0 for success and nonzero for errors.51* Any diagnostics generated will be written to either {@code out}52* or {@code err} in some unspecified format.53*54* @param in "standard" input; use System.in if null55* @param out "standard" output; use System.out if null56* @param err "standard" error; use System.err if null57* @param arguments arguments to pass to the tool58* @return 0 for success; nonzero otherwise59* @throws NullPointerException if the array of arguments contains60* any {@code null} elements.61*/62int run(InputStream in, OutputStream out, OutputStream err, String... arguments);6364/**65* Gets the source versions of the Java™ programming language66* supported by this tool.67* @return a set of supported source versions68*/69Set<SourceVersion> getSourceVersions();7071}727374