Stay organized with collections
Save and categorize content based on your preferences.
Compiler
public
final
class
Compiler
extends Object
Does nothing on Android.
Summary
Public methods |
static
Object
|
command(Object cmd)
Executes an operation according to the specified command object.
|
static
boolean
|
compileClass(Class<?> classToCompile)
Compiles the specified class using the JIT compiler and indicates if
compilation has been successful.
|
static
boolean
|
compileClasses(String nameRoot)
Compiles all classes whose name matches the specified name using the JIT
compiler and indicates if compilation has been successful.
|
static
void
|
disable()
Disables the JIT compiler.
|
static
void
|
enable()
Enables the JIT compiler.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public methods
command
public static Object command (Object cmd)
Executes an operation according to the specified command object. This
method is the low-level interface to the JIT compiler. It may return any
object or null
if no JIT compiler is available. Returns null
on Android, whether or not the system has a JIT.
Parameters |
cmd |
Object : the command object for the JIT compiler. |
Returns |
Object |
the result of executing command or null . |
compileClass
public static boolean compileClass (Class<?> classToCompile)
Compiles the specified class using the JIT compiler and indicates if
compilation has been successful. Does nothing and returns false on
Android.
Parameters |
classToCompile |
Class : java.lang.Class the class to JIT compile |
Returns |
boolean |
true if the compilation has been successful;
false if it has failed or if there is no JIT compiler
available. |
compileClasses
public static boolean compileClasses (String nameRoot)
Compiles all classes whose name matches the specified name using the JIT
compiler and indicates if compilation has been successful. Does nothing
and returns false on Android.
Parameters |
nameRoot |
String : the string to match class names with. |
Returns |
boolean |
true if the compilation has been successful;
false if it has failed or if there is no JIT compiler
available. |
disable
public static void disable ()
Disables the JIT compiler. Does nothing on Android.
enable
public static void enable ()
Enables the JIT compiler. Does nothing on Android.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Compiler\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nCompiler\n========\n\n\n`\npublic\n\nfinal\n\nclass\nCompiler\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|--------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | java.lang.Compiler |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nDoes nothing on Android.\n\nSummary\n-------\n\n| ### Public methods ||\n|-------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static `[Object](/reference/java/lang/Object) | ` `[command](/reference/java/lang/Compiler#command(java.lang.Object))`(`[Object](/reference/java/lang/Object)` cmd) ` Executes an operation according to the specified command object. |\n| ` static boolean` | ` `[compileClass](/reference/java/lang/Compiler#compileClass(java.lang.Class\u003c?\u003e))`(`[Class](/reference/java/lang/Class)`\u003c?\u003e classToCompile) ` Compiles the specified class using the JIT compiler and indicates if compilation has been successful. |\n| ` static boolean` | ` `[compileClasses](/reference/java/lang/Compiler#compileClasses(java.lang.String))`(`[String](/reference/java/lang/String)` nameRoot) ` Compiles all classes whose name matches the specified name using the JIT compiler and indicates if compilation has been successful. |\n| ` static void` | ` `[disable](/reference/java/lang/Compiler#disable())`() ` Disables the JIT compiler. |\n| ` static void` | ` `[enable](/reference/java/lang/Compiler#enable())`() ` Enables the JIT compiler. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic methods\n--------------\n\n### command\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static Object command (Object cmd)\n```\n\nExecutes an operation according to the specified command object. This\nmethod is the low-level interface to the JIT compiler. It may return any\nobject or `null` if no JIT compiler is available. Returns null\non Android, whether or not the system has a JIT.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|-----------------------------------------------------------|\n| `cmd` | `Object`: the command object for the JIT compiler. \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------|---------------------------------------------------|\n| [Object](/reference/java/lang/Object) | the result of executing command or `null`. \u003cbr /\u003e |\n\n### compileClass\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static boolean compileClass (Class\u003c?\u003e classToCompile)\n```\n\nCompiles the specified class using the JIT compiler and indicates if\ncompilation has been successful. Does nothing and returns false on\nAndroid.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------------|----------------------------------------------------------|\n| `classToCompile` | `Class`: java.lang.Class the class to JIT compile \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------|\n| `boolean` | `true` if the compilation has been successful; `false` if it has failed or if there is no JIT compiler available. \u003cbr /\u003e |\n\n### compileClasses\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static boolean compileClasses (String nameRoot)\n```\n\nCompiles all classes whose name matches the specified name using the JIT\ncompiler and indicates if compilation has been successful. Does nothing\nand returns false on Android.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------------------------------------|\n| `nameRoot` | `String`: the string to match class names with. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------|\n| `boolean` | `true` if the compilation has been successful; `false` if it has failed or if there is no JIT compiler available. \u003cbr /\u003e |\n\n### disable\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static void disable ()\n```\n\nDisables the JIT compiler. Does nothing on Android.\n\n\u003cbr /\u003e\n\n### enable\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static void enable ()\n```\n\nEnables the JIT compiler. Does nothing on Android.\n\n\u003cbr /\u003e"]]