Wed, 08 Oct 2014 14:16:40 -0700
Merge
duke@1 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 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 |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@554 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 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. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | /** |
duke@1 | 27 | * Provides interfaces for tools which can be invoked from a program, |
duke@1 | 28 | * for example, compilers. |
duke@1 | 29 | * |
duke@1 | 30 | * <p>These interfaces and classes are required as part of the |
duke@1 | 31 | * Java™ Platform, Standard Edition (Java SE), |
duke@1 | 32 | * but there is no requirement to provide any tools implementing them. |
duke@1 | 33 | * |
duke@1 | 34 | * <p>Unless explicitly allowed, all methods in this package might |
duke@1 | 35 | * throw a {@linkplain java.lang.NullPointerException} if given a |
duke@1 | 36 | * {@code null} argument or if given a |
duke@1 | 37 | * {@linkplain java.lang.Iterable list or collection} containing |
duke@1 | 38 | * {@code null} elements. Similarly, no method may return |
duke@1 | 39 | * {@code null} unless explicitly allowed. |
duke@1 | 40 | * |
duke@1 | 41 | * <p>This package is the home of the Java programming language compiler framework. This |
duke@1 | 42 | * framework allows clients of the framework to locate and run |
duke@1 | 43 | * compilers from programs. The framework also provides Service |
duke@1 | 44 | * Provider Interfaces (SPI) for structured access to diagnostics |
duke@1 | 45 | * ({@linkplain javax.tools.DiagnosticListener}) as well as a file |
duke@1 | 46 | * abstraction for overriding file access ({@linkplain |
duke@1 | 47 | * javax.tools.JavaFileManager} and {@linkplain |
duke@1 | 48 | * javax.tools.JavaFileObject}). See {@linkplain |
duke@1 | 49 | * javax.tools.JavaCompiler} for more details on using the SPI. |
duke@1 | 50 | * |
duke@1 | 51 | * <p>There is no requirement for a compiler at runtime. However, if |
duke@1 | 52 | * a default compiler is provided, it can be located using the |
duke@1 | 53 | * {@linkplain javax.tools.ToolProvider}, for example: |
duke@1 | 54 | * |
duke@1 | 55 | * <p>{@code JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();} |
duke@1 | 56 | * |
duke@1 | 57 | * <p>It is possible to provide alternative compilers or tools |
duke@1 | 58 | * through the {@linkplain java.util.ServiceLoader service provider |
duke@1 | 59 | * mechanism}. |
duke@1 | 60 | * |
duke@1 | 61 | * <p>For example, if {@code com.vendor.VendorJavaCompiler} is a |
duke@1 | 62 | * provider of the {@code JavaCompiler} tool then its jar file |
duke@1 | 63 | * would contain the file {@code |
duke@1 | 64 | * META-INF/services/javax.tools.JavaCompiler}. This file would |
duke@1 | 65 | * contain the single line: |
duke@1 | 66 | * |
duke@1 | 67 | * <p>{@code com.vendor.VendorJavaCompiler} |
duke@1 | 68 | * |
duke@1 | 69 | * <p>If the jar file is on the class path, VendorJavaCompiler can be |
duke@1 | 70 | * located using code like this: |
duke@1 | 71 | * |
duke@1 | 72 | * <p>{@code JavaCompiler compiler = ServiceLoader.load(JavaCompiler.class).iterator().next();} |
duke@1 | 73 | * |
duke@1 | 74 | * @author Peter von der Ahé |
duke@1 | 75 | * @author Jonathan Gibbons |
duke@1 | 76 | * @since 1.6 |
duke@1 | 77 | */ |
duke@1 | 78 | package javax.tools; |