Path: blob/master/src/java.compiler/share/classes/javax/tools/package-info.java
41152 views
/*1* Copyright (c) 2005, 2020, 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*/2425/**26* Provides interfaces for tools which can be invoked from a program,27* for example, compilers.28*29* <p>These interfaces and classes are required as part of the30* Java Platform, Standard Edition (Java SE),31* but there is no requirement to provide any tools implementing them.32*33* <p>Unless explicitly allowed, all methods in this package might34* throw a {@link java.lang.NullPointerException} if given a35* {@code null} argument or if given a36* {@linkplain java.lang.Iterable list or collection} containing37* {@code null} elements. Similarly, no method may return38* {@code null} unless explicitly allowed.39*40* <p>This package is the home of the Java programming language compiler framework.41* This framework allows clients of the framework to locate and run42* compilers from programs. The framework also provides Service43* Provider Interfaces (SPI) for structured access to diagnostics44* ({@link javax.tools.DiagnosticListener}) as well as a file45* abstraction for overriding file access ({@link46* javax.tools.JavaFileManager} and {@link47* javax.tools.JavaFileObject}). See {@link48* javax.tools.JavaCompiler} for more details on using the SPI.49*50* <p>There is no requirement for a compiler at runtime. However, if51* a default compiler is provided, it can be located using the52* {@link javax.tools.ToolProvider}, for example:53*54* <p>{@code JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();}55*56* <p>It is possible to provide alternative compilers or tools57* through the {@linkplain java.util.ServiceLoader service provider58* mechanism}.59*60* <p>For example, if {@code com.vendor.VendorJavaCompiler} is a61* provider of the {@code JavaCompiler} tool then its jar file62* would contain the file {@code63* META-INF/services/javax.tools.JavaCompiler}. This file would64* contain the single line:65*66* <p>{@code com.vendor.VendorJavaCompiler}67*68* <p>If the jar file is on the class path, VendorJavaCompiler can be69* located using code like this:70*71* <p>{@code JavaCompiler compiler = ServiceLoader.load(JavaCompiler.class).iterator().next();}72*73* @author Peter von der Ahé74* @author Jonathan Gibbons75* @since 1.676*/77package javax.tools;787980