1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package java.lang;
19
20/**
21 * Does nothing on Android.
22 */
23public final class Compiler {
24    /**
25     * Prevent this class from being instantiated.
26     */
27    private Compiler() {
28        //do nothing
29    }
30
31    /**
32     * Executes an operation according to the specified command object. This
33     * method is the low-level interface to the JIT compiler. It may return any
34     * object or {@code null} if no JIT compiler is available. Returns null
35     * on Android, whether or not the system has a JIT.
36     *
37     * @param cmd
38     *            the command object for the JIT compiler.
39     * @return the result of executing command or {@code null}.
40     */
41    public static Object command(Object cmd) {
42        return null;
43    }
44
45    /**
46     * Compiles the specified class using the JIT compiler and indicates if
47     * compilation has been successful. Does nothing and returns false on
48     * Android.
49     *
50     * @param classToCompile
51     *            java.lang.Class the class to JIT compile
52     * @return {@code true} if the compilation has been successful;
53     *         {@code false} if it has failed or if there is no JIT compiler
54     *         available.
55     */
56    public static boolean compileClass(Class<?> classToCompile) {
57        return false;
58    }
59
60    /**
61     * Compiles all classes whose name matches the specified name using the JIT
62     * compiler and indicates if compilation has been successful. Does nothing
63     * and returns false on Android.
64     *
65     * @param nameRoot
66     *            the string to match class names with.
67     * @return {@code true} if the compilation has been successful;
68     *         {@code false} if it has failed or if there is no JIT compiler
69     *         available.
70     */
71    public static boolean compileClasses(String nameRoot) {
72        return false;
73    }
74
75    /**
76     * Disables the JIT compiler. Does nothing on Android.
77     */
78    public static void disable() {
79    }
80
81    /**
82     * Enables the JIT compiler. Does nothing on Android.
83     */
84    public static void enable() {
85    }
86}
87