Spec-Zone .ru
спецификации, руководства, описания, API
|
|
Java™ Platform Standard Ed. 7 DRAFT ea-b118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={TYPE_USE,TYPE,METHOD,CONSTRUCTOR}) @Retention(value=SOURCE) public @interface BootstrapMethod
Annotation on InvokeDynamic method calls which requests the JVM to use a specific bootstrap method to link the call. This annotation is not retained as such in the class file, but is transformed into a constant-pool entry for the invokedynamic instruction which specifies the desired bootstrap method.
If only the value
is given, it must name a subclass of CallSite
with a constructor which accepts a class, string, and method type.
If the value
and name
are both given, there must be
a static method in the given class of the given name which accepts a class, string,
and method type, and returns a reference coercible to CallSite
.
This annotation can be placed either on the return type of a single InvokeDynamic
call (see examples) or else it can be placed on an enclosing class or method, where it
determines a default bootstrap method for any InvokeDynamic
calls which are not
specifically annotated with a bootstrap method.
Every InvokeDynamic
call must be given a bootstrap method.
Examples:
@BootstrapMethod(value=MyLanguageRuntime.class, name="bootstrapDynamic") String x = (String) InvokeDynamic.greet(); //BSM => MyLanguageRuntime.bootstrapDynamic(Here.class, "greet", methodType(String.class)) @BootstrapMethod(MyCallSite.class) void example() throws Throwable { InvokeDynamic.greet(); //BSM => new MyCallSite(Here.class, "greet", methodType(void.class)) }
Modifier and Type | Required Element and Description |
---|---|
Class<?> |
value
The class containing the bootstrap method. |
Modifier and Type | Optional Element and Description |
---|---|
Class<?>[] |
arguments
The argument types of the bootstrap method, as passed out by the JVM. |
String |
name
The name of the bootstrap method. |
Element Detail |
---|
public abstract Class<?> value
public abstract String name
public abstract Class<?>[] arguments
|
Java™ Platform Standard Ed. 7 DRAFT ea-b118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
Copyright © 1993, 2010, Oracle Corporation. All rights reserved.