295 * the return type is the interface to implement. When
296 * used with {@code invokedynamic}, this is provided by
297 * the {@code NameAndType} of the {@code InvokeDynamic}
298 * structure and is stacked automatically by the VM.
299 * @param interfaceMethodType Signature and return type of method to be
300 * implemented by the function object.
301 * @param implementation A direct method handle describing the implementation
302 * method which should be called (with suitable adaptation
303 * of argument types and return types, and with captured
304 * arguments prepended to the invocation arguments) at
305 * invocation time.
306 * @param dynamicMethodType The signature and return type that should
307 * be enforced dynamically at invocation time.
308 * In simple use cases this is the same as
309 * {@code interfaceMethodType}.
310 * @return a CallSite whose target can be used to perform capture, generating
311 * instances of the interface named by {@code factoryType}
312 * @throws LambdaConversionException If {@code caller} does not have full privilege
313 * access, or if {@code interfaceMethodName} is not a valid JVM
314 * method name, or if the return type of {@code factoryType} is not
315 * an interface, or if {@code implementation} is not a direct method
316 * handle referencing a method or constructor, or if the linkage
317 * invariants are violated, as defined {@link LambdaMetafactory above}.
318 * @throws NullPointerException If any argument is {@code null}.
319 * @throws SecurityException If a security manager is present, and it
320 * <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
321 * from {@code caller} to the package of {@code implementation}.
322 */
323 public static CallSite metafactory(MethodHandles.Lookup caller,
324 String interfaceMethodName,
325 MethodType factoryType,
326 MethodType interfaceMethodType,
327 MethodHandle implementation,
328 MethodType dynamicMethodType)
329 throws LambdaConversionException {
330 AbstractValidatingLambdaMetafactory mf;
331 mf = new InnerClassLambdaMetafactory(Objects.requireNonNull(caller),
332 Objects.requireNonNull(factoryType),
333 Objects.requireNonNull(interfaceMethodName),
334 Objects.requireNonNull(interfaceMethodType),
335 Objects.requireNonNull(implementation),
|
295 * the return type is the interface to implement. When
296 * used with {@code invokedynamic}, this is provided by
297 * the {@code NameAndType} of the {@code InvokeDynamic}
298 * structure and is stacked automatically by the VM.
299 * @param interfaceMethodType Signature and return type of method to be
300 * implemented by the function object.
301 * @param implementation A direct method handle describing the implementation
302 * method which should be called (with suitable adaptation
303 * of argument types and return types, and with captured
304 * arguments prepended to the invocation arguments) at
305 * invocation time.
306 * @param dynamicMethodType The signature and return type that should
307 * be enforced dynamically at invocation time.
308 * In simple use cases this is the same as
309 * {@code interfaceMethodType}.
310 * @return a CallSite whose target can be used to perform capture, generating
311 * instances of the interface named by {@code factoryType}
312 * @throws LambdaConversionException If {@code caller} does not have full privilege
313 * access, or if {@code interfaceMethodName} is not a valid JVM
314 * method name, or if the return type of {@code factoryType} is not
315 * an interface, or if the return type of {@code factoryType} is a value
316 * interface, or if {@code implementation} is not a direct method
317 * handle referencing a method or constructor, or if the linkage
318 * invariants are violated, as defined {@link LambdaMetafactory above}.
319 * @throws NullPointerException If any argument is {@code null}.
320 * @throws SecurityException If a security manager is present, and it
321 * <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
322 * from {@code caller} to the package of {@code implementation}.
323 */
324 public static CallSite metafactory(MethodHandles.Lookup caller,
325 String interfaceMethodName,
326 MethodType factoryType,
327 MethodType interfaceMethodType,
328 MethodHandle implementation,
329 MethodType dynamicMethodType)
330 throws LambdaConversionException {
331 AbstractValidatingLambdaMetafactory mf;
332 mf = new InnerClassLambdaMetafactory(Objects.requireNonNull(caller),
333 Objects.requireNonNull(factoryType),
334 Objects.requireNonNull(interfaceMethodName),
335 Objects.requireNonNull(interfaceMethodType),
336 Objects.requireNonNull(implementation),
|