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 * Placeholder class for environments which explicitly manage the action of a
22 * <em>Just In Time (JIT)</em> compiler. This class is usually implemented by
23 * the virtual machine vendor. The Android reference implementation does not
24 * (yet) contain such a JIT compiler, though other implementations may choose to
25 * provide one.
26 *
27 * @since Android 1.0
28 */
29public final class Compiler {
30
31    /**
32     * Prevent this class from being instantiated.
33     */
34    private Compiler(){
35        //do nothing
36    }
37
38    /**
39     * Executes an operation according to the specified command object. This
40     * method is the low-level interface to the JIT compiler. It may return any
41     * object or {@code null} if no JIT compiler is available.
42     *
43     * @param cmd
44     *            the command object for the JIT compiler.
45     * @return the result of executing command or {@code null}.
46     * @since Android 1.0
47     */
48    public static Object command(Object cmd) {
49        return null;
50    }
51
52    /**
53     * Compiles the specified class using the JIT compiler and indicates if
54     * compilation has been successful.
55     *
56     * @param classToCompile
57     *            java.lang.Class the class to JIT compile
58     * @return {@code true} if the compilation has been successful;
59     *         {@code false} if it has failed or if there is no JIT compiler
60     *         available.
61     * @since Android 1.0
62     */
63    public static boolean compileClass(Class<?> classToCompile) {
64        return false;
65    }
66
67    /**
68     * Compiles all classes whose name matches the specified name using the JIT
69     * compiler and indicates if compilation has been successful.
70     *
71     * @param nameRoot
72     *            the string to match class names with.
73     * @return {@code true} if the compilation has been successful;
74     *         {@code false} if it has failed or if there is no JIT compiler
75     *         available.
76     * @since Android 1.0
77     */
78    public static boolean compileClasses(String nameRoot) {
79        return false;
80    }
81
82    /**
83     * Disables the JIT compiler.
84     *
85     * @since Android 1.0
86     */
87    public static void disable() {
88        return;
89    }
90
91    /**
92     * Enables the JIT compiler.
93     *
94     * @since Android 1.0
95     */
96    public static void enable() {
97        return;
98    }
99
100}
101