1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 only, as
8  * published by the Free Software Foundation.  Oracle designates this
9  * particular file as subject to the "Classpath" exception as provided
10  * by Oracle in the LICENSE file that accompanied this code.
11  *
12  * This code is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15  * version 2 for more details (a copy is included in the LICENSE file that
16  * accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License version
19  * 2 along with this work; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23  * or visit www.oracle.com if you need additional information or have any
24  * questions.
25  */
26 
27 package java.lang;
28 
29 /**
30  * Does nothing on Android.
31  */
32 public final class Compiler  {
33     /**
34      * Prevent this class from being instantiated.
35      */
Compiler()36     private Compiler() {}               // don't make instances
37 
38     /**
39      * Compiles the specified class using the JIT compiler and indicates if
40      * compilation has been successful. Does nothing and returns false on
41      * Android.
42      *
43      * @param classToCompile
44      *            java.lang.Class the class to JIT compile
45      * @return {@code true} if the compilation has been successful;
46      *         {@code false} if it has failed or if there is no JIT compiler
47      *         available.
48      */
compileClass(Class<?> classToCompile)49     public static boolean compileClass(Class<?> classToCompile) {
50         return false;
51     }
52 
53     /**
54      * Compiles all classes whose name matches the specified name using the JIT
55      * compiler and indicates if compilation has been successful. Does nothing
56      * and returns false on Android.
57      *
58      * @param nameRoot
59      *            the string to match class names with.
60      * @return {@code true} if the compilation has been successful;
61      *         {@code false} if it has failed or if there is no JIT compiler
62      *         available.
63      */
compileClasses(String nameRoot)64     public static boolean compileClasses(String nameRoot) {
65         return false;
66     }
67 
68     /**
69      * Executes an operation according to the specified command object. This
70      * method is the low-level interface to the JIT compiler. It may return any
71      * object or {@code null} if no JIT compiler is available. Returns null
72      * on Android, whether or not the system has a JIT.
73      *
74      * @param cmd
75      *            the command object for the JIT compiler.
76      * @return the result of executing command or {@code null}.
77      */
command(Object cmd)78     public static Object command(Object cmd) {
79         return null;
80     }
81 
82     /**
83      * Enables the JIT compiler. Does nothing on Android.
84      */
enable()85     public static void enable() {
86 
87     }
88 
89     /**
90      * Disables the JIT compiler. Does nothing on Android.
91      */
disable()92     public static void disable() {
93 
94     }
95 }
96