[ 
https://issues.apache.org/jira/browse/FLINK-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14108930#comment-14108930
 ] 

Stephan Ewen commented on FLINK-1062:
-------------------------------------

Here is how we currently identify Lambdas

{code}
public interface LambdaFunction extends java.io.Serializable {
    String doComputation(Integer value);
}

public static void main(String[] args) throws Exception {
    LambdaFunction func = (theInteger) -> "string " + 
String.valueOf(theInteger);

    for (Class<?> clazz = func.getClass(); clazz != null; clazz = 
clazz.getSuperclass()) {
        try {
            Method replaceMethod = clazz.getDeclaredMethod("writeReplace");
            replaceMethod.setAccessible(true);
            Object serializedForm = replaceMethod.invoke(func);

            if (serializedForm instanceof SerializedLambda) {
                SerializedLambda sl = (SerializedLambda) serializedForm;
                System.out.println(sl);
                break;
            }
        }
        catch (NoSuchMethodError e) {
            // fall through the loop and try the next class
        }
        catch (Throwable t) {
            t.printStackTrace();
            return;
        }
    }
}
{code}

> Type Extraction for Lambdas
> ---------------------------
>
>                 Key: FLINK-1062
>                 URL: https://issues.apache.org/jira/browse/FLINK-1062
>             Project: Flink
>          Issue Type: Improvement
>          Components: Java API
>    Affects Versions: 0.7-incubating
>            Reporter: Stephan Ewen
>             Fix For: 0.7-incubating
>
>
> Lambdas currently work only for {{filter}} and {{reduce(a,b)}}, because 
> Lambda type extraction is not in place right now.
> We need to extend the type extraction for lambdas to support the other 
> functions.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to