< prev index next >

src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java

Print this page




 194  * the interface method(s) may differ in several ways.  The implementation
 195  * methods may have additional arguments to accommodate arguments captured by
 196  * the lambda expression; there may also be differences resulting from permitted
 197  * adaptations of arguments, such as casting, boxing, unboxing, and primitive
 198  * widening. (Varargs adaptations are not handled by the metafactories; these are
 199  * expected to be handled by the caller.)
 200  *
 201  * <p>Invokedynamic call sites have two argument lists: a static argument list
 202  * and a dynamic argument list.  The static argument list is stored in the
 203  * constant pool; the dynamic argument is pushed on the operand stack at capture
 204  * time.  The bootstrap method has access to the entire static argument list
 205  * (which in this case, includes information describing the implementation method,
 206  * the target interface, and the target interface method(s)), as well as a
 207  * method signature describing the number and static types (but not the values)
 208  * of the dynamic arguments and the static return type of the invokedynamic site.
 209  *
 210  * @implNote The implementation method is described with a method handle. In
 211  * theory, any method handle could be used. Currently supported are direct method
 212  * handles representing invocation of virtual, interface, constructor and static
 213  * methods.

 214  */
 215 public class LambdaMetafactory {
 216 
 217     /** Flag for alternate metafactories indicating the lambda object
 218      * must be serializable */
 219     public static final int FLAG_SERIALIZABLE = 1 << 0;
 220 
 221     /**
 222      * Flag for alternate metafactories indicating the lambda object implements
 223      * other marker interfaces
 224      * besides Serializable
 225      */
 226     public static final int FLAG_MARKERS = 1 << 1;
 227 
 228     /**
 229      * Flag for alternate metafactories indicating the lambda object requires
 230      * additional bridge methods
 231      */
 232     public static final int FLAG_BRIDGES = 1 << 2;
 233 




 194  * the interface method(s) may differ in several ways.  The implementation
 195  * methods may have additional arguments to accommodate arguments captured by
 196  * the lambda expression; there may also be differences resulting from permitted
 197  * adaptations of arguments, such as casting, boxing, unboxing, and primitive
 198  * widening. (Varargs adaptations are not handled by the metafactories; these are
 199  * expected to be handled by the caller.)
 200  *
 201  * <p>Invokedynamic call sites have two argument lists: a static argument list
 202  * and a dynamic argument list.  The static argument list is stored in the
 203  * constant pool; the dynamic argument is pushed on the operand stack at capture
 204  * time.  The bootstrap method has access to the entire static argument list
 205  * (which in this case, includes information describing the implementation method,
 206  * the target interface, and the target interface method(s)), as well as a
 207  * method signature describing the number and static types (but not the values)
 208  * of the dynamic arguments and the static return type of the invokedynamic site.
 209  *
 210  * @implNote The implementation method is described with a method handle. In
 211  * theory, any method handle could be used. Currently supported are direct method
 212  * handles representing invocation of virtual, interface, constructor and static
 213  * methods.
 214  * @since 1.8
 215  */
 216 public class LambdaMetafactory {
 217 
 218     /** Flag for alternate metafactories indicating the lambda object
 219      * must be serializable */
 220     public static final int FLAG_SERIALIZABLE = 1 << 0;
 221 
 222     /**
 223      * Flag for alternate metafactories indicating the lambda object implements
 224      * other marker interfaces
 225      * besides Serializable
 226      */
 227     public static final int FLAG_MARKERS = 1 << 1;
 228 
 229     /**
 230      * Flag for alternate metafactories indicating the lambda object requires
 231      * additional bridge methods
 232      */
 233     public static final int FLAG_BRIDGES = 1 << 2;
 234 


< prev index next >