Name of lambda parameters
Remi Forax
forax at univ-mlv.fr
Mon Jan 7 10:04:02 PST 2013
(CC Alex Buckley)
As noticed recently on lambda-dev mailing list,
there is no way to get the parameter names of a lambda because
there is no way to do reflection on a lambda (an object implementing a
functional interface) to get the corresponding declared method.
do we need a static method Parameter[] Method.getLambdaParameters(Object
lambdaProxy) ?
The fact that it takes an object and not stable value (like a class,
etc) doesn't seem a good idea
This may require bookkeeping when doing the functional interface conversion.
By example, the generated lambda proxy can implement a non-public
interface to extract this information and for the method handle proxy,
it can use the internal API used by the metafactory to crack the method
handle.
So, like serialization, may we need to have a special empty interface
NamedParameterLambda to tag these specific lambdas ? In that case, the
method getLambdaParameters can be a static method of NamedParameterLambda,
Parameter[] getLambdaParameters(NamedParameterLambda lambdaProxy).
Rémi
More information about the lambda-libs-spec-observers
mailing list