Spec-Zone .ru
спецификации, руководства, описания, API
Please note that the specifications and other information contained herein are not final and are subject to change. The information is being made available to you solely for purpose of evaluation.

Java™ Platform
Standard Ed. 7

DRAFT ea-b118

java.dyn
Class Linkage

java.lang.Object
  extended by java.dyn.Linkage

public class Linkage
extends Object

This class consists exclusively of static methods that control the linkage of invokedynamic instructions, and specifically their reification as CallSite objects.


Field Summary
Modifier and Type Field and Description
static MethodType BOOTSTRAP_METHOD_TYPE
          PROVISIONAL API, WORK IN PROGRESS: The type of any bootstrap method is a three-argument method (Class, String, MethodType) returning a CallSite.
 
Method Summary
Modifier and Type Method and Description
static MethodHandle getBootstrapMethod(Class callerClass)
          Deprecated.  
static Object invalidateAll()
          PROVISIONAL API, WORK IN PROGRESS: Invalidate all invokedynamic call sites everywhere.
static Object invalidateCallerClass(Class<?> callerClass)
          PROVISIONAL API, WORK IN PROGRESS: Invalidate all invokedynamic call sites in the bytecodes of any methods of the given class.
static void registerBootstrapMethod(Class<?> runtime, String name)
          Deprecated. Use @BootstrapMethod annotations instead
static void registerBootstrapMethod(Class callerClass, MethodHandle bootstrapMethod)
          Deprecated. Use @BootstrapMethod annotations instead
static void registerBootstrapMethod(String name)
          Deprecated. Use @BootstrapMethod annotations instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOTSTRAP_METHOD_TYPE

public static final MethodType BOOTSTRAP_METHOD_TYPE
PROVISIONAL API, WORK IN PROGRESS: The type of any bootstrap method is a three-argument method (Class, String, MethodType) returning a CallSite.

Method Detail

registerBootstrapMethod

public static void registerBootstrapMethod(Class callerClass,
                                           MethodHandle bootstrapMethod)
Deprecated. Use @BootstrapMethod annotations instead

PROVISIONAL API, WORK IN PROGRESS: Register a bootstrap method to use when linking dynamic call sites within a given caller class.

A bootstrap method must be a method handle with a return type of CallSite and the following arguments:

The bootstrap method acts as a factory method which accepts the given arguments and returns a CallSite object (possibly of a subclass of CallSite).

The registration must take place exactly once, either before the class has begun being initialized, or from within the class's static initializer. Registration will fail with an exception if any of the following conditions hold:

Because of these rules, a class may install its own bootstrap method in a static initializer.

Parameters:
callerClass - a class that may have invokedynamic sites
bootstrapMethod - the method to use to bootstrap all such sites
Throws:
IllegalArgumentException - if the class argument is null or a primitive class, or if the bootstrap method is the wrong type
IllegalStateException - if the class already has a bootstrap method, or if the its static initializer has already run or is already running in another thread
SecurityException - if there is a security manager installed, and a LinkagePermission check fails for "registerBootstrapMethod"

registerBootstrapMethod

public static void registerBootstrapMethod(Class<?> runtime,
                                           String name)
Deprecated. Use @BootstrapMethod annotations instead

PROVISIONAL API, WORK IN PROGRESS: Simplified version of registerBootstrapMethod for self-registration, to be called from a static initializer. Finds a static method of the required type in the given runtime class, and installs it on the caller class.

Throws:
NoSuchMethodException - if there is no such method
IllegalStateException - if the caller class's static initializer has already run, or is already running in another thread

registerBootstrapMethod

public static void registerBootstrapMethod(String name)
Deprecated. Use @BootstrapMethod annotations instead

PROVISIONAL API, WORK IN PROGRESS: Simplified version of registerBootstrapMethod for self-registration, to be called from a static initializer. Finds a static method of the required type in the caller class itself, and installs it on the caller class.

Throws:
IllegalArgumentException - if there is no such method
IllegalStateException - if the caller class's static initializer has already run, or is already running in another thread

getBootstrapMethod

public static MethodHandle getBootstrapMethod(Class callerClass)
Deprecated. 

PROVISIONAL API, WORK IN PROGRESS: Report the bootstrap method registered for a given caller class. Returns null if the class has never yet registered a bootstrap method. Only callers privileged to set the bootstrap method may inquire about it, because a bootstrap method is potentially a back-door entry point into its class.

Throws:
IllegalArgumentException - if the argument is null or a primitive class
SecurityException - if there is a security manager installed, and the immediate caller of this method is not in the same package as the caller class and a LinkagePermission check fails for "getBootstrapMethod"

invalidateAll

public static Object invalidateAll()
PROVISIONAL API, WORK IN PROGRESS: Invalidate all invokedynamic call sites everywhere.

When this method returns, every invokedynamic instruction will invoke its bootstrap method on next call.

It is unspecified whether call sites already known to the Java code will continue to be associated with invokedynamic instructions. If any call site is still so associated, its CallSite.getTarget() method is guaranteed to return null the invalidation operation completes.

Invalidation operations are likely to be slow. Use them sparingly.


invalidateCallerClass

public static Object invalidateCallerClass(Class<?> callerClass)
PROVISIONAL API, WORK IN PROGRESS: Invalidate all invokedynamic call sites in the bytecodes of any methods of the given class.

When this method returns, every matching invokedynamic instruction will invoke its bootstrap method on next call.

For additional semantics of call site invalidation, see invalidateAll().


Java™ Platform
Standard Ed. 7

DRAFT ea-b118

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 1993, 2010, Oracle Corporation. All rights reserved.
DRAFT ea-b118

Scripting on this page tracks web page traffic, but does not change the content in any way.