JDK-8004970 : Alternate lambda metafactory
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2012-12-12
  • Updated: 2013-07-22
  • Resolved: 2013-02-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b82Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
The language runtime needs to be enhanced with an alternate metafactory which can inject additional marker interfaces.  Its signature and behavior is described below:

    /**
     * Alternate meta-factory for conversion of lambda expressions or method references to functional interfaces,
     * which supports serialization and other uncommon options.
     *
     * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges
     *               of the caller.
     * @param invokedName Stacked automatically by VM; the name of the invoked method as it appears at the call site.
     *                    Currently unused.
     * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes the
     *                    expected static type of the returned lambda object, and the static types of the captured
     *                    arguments for the lambda.  In the event that the implementation method is an instance method,
     *                    the first argument in the invocation signature will correspond to the receiver.
     * @param samMethod The primary method in the functional interface to which the lambda or method reference is
     *                  being converted, represented as a method handle.
     * @param implMethod The implementation method which should be called (with suitable adaptation of argument
     *                   types, return types, and adjustment for captured arguments) when methods of the resulting
     *                   functional interface instance are invoked.
     * @param instantiatedMethodType The signature of the SAM method from the functional interface's perspective
     * @param flags A bitmask containing flags that may influence the translation of this lambda expression.  Defined
     *              fields include FLAG_SERIALIZABLE.
     * @param markerInterfaces Additional interfaces which the lambda object should implement.
     * @return a CallSite, which, when invoked, will return an instance of the functional interface
     * @throws ReflectiveOperationException
     * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
     */
    public static CallSite altMetaFactory(MethodHandles.Lookup caller,
                                          String invokedName,
                                          MethodType invokedType,
                                          MethodHandle samMethod,
                                          MethodHandle implMethod,
                                          MethodType instantiatedMethodType,
                                          int flags,
                                          Class... markerInterfaces)
            throws ReflectiveOperationException, LambdaConversionException