1 /* 2 * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.lang; 27 28 /** 29 * The {@code Compiler} class is provided to support Java-to-native-code 30 * compilers and related services. By design, the {@code Compiler} class does 31 * nothing; it serves as a placeholder for a JIT compiler implementation. 32 * If no compiler is available, these methods do nothing. 33 * 34 * @deprecated JIT compilers and their technologies vary too widely to 35 * be controlled effectively by a standardized interface. As such, many 36 * JIT compiler implementations ignore this interface, and are instead 37 * controllable by implementation-specific mechanisms such as command-line 38 * options. This class is subject to removal in a future version of Java SE. 39 * 40 * @author Frank Yellin 41 * @since 1.0 42 */ 43 @Deprecated(since="9", forRemoval=true) 44 public final class Compiler { Compiler()45 private Compiler() {} // don't make instances 46 47 /** 48 * Compiles the specified class. 49 * 50 * @param clazz 51 * A class 52 * 53 * @return {@code true} if the compilation succeeded; {@code false} if the 54 * compilation failed or no compiler is available 55 * 56 * @throws NullPointerException 57 * If {@code clazz} is {@code null} 58 */ compileClass(Class<?> clazz)59 public static boolean compileClass(Class<?> clazz) { 60 return false; 61 } 62 63 /** 64 * Compiles all classes whose name matches the specified string. 65 * 66 * @param string 67 * The name of the classes to compile 68 * 69 * @return {@code true} if the compilation succeeded; {@code false} if the 70 * compilation failed or no compiler is available 71 * 72 * @throws NullPointerException 73 * If {@code string} is {@code null} 74 */ compileClasses(String string)75 public static boolean compileClasses(String string) { 76 return false; 77 } 78 79 /** 80 * Examines the argument type and its fields and perform some documented 81 * operation. No specific operations are required. 82 * 83 * @param any 84 * An argument 85 * 86 * @return A compiler-specific value, or {@code null} if no compiler is 87 * available 88 * 89 * @throws NullPointerException 90 * If {@code any} is {@code null} 91 */ command(Object any)92 public static Object command(Object any) { 93 return null; 94 } 95 96 /** 97 * Cause the Compiler to resume operation. 98 */ enable()99 public static void enable() { } 100 101 /** 102 * Cause the Compiler to cease operation. 103 */ disable()104 public static void disable() { } 105 } 106