Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] Generic signature for Lambda Expressions

Hi all,

I'm working for the Apache Flink project. With our upcoming release we wanted to support Lambda Expressions and relied on a feature that only the Eclipse JDT compiler had so far: Lambda Expressions which contain a generic signature, in order to be type-safe. Before the patch for Bug 436542 was merged, we could extract type information from code like:

public class Test {
    public static interface Map<IN, OUT> {
        public OUT map(IN in);
    }

    public static class Tuple<T1, T2> {
        private T1 field1;
        private T2 field2;
    }

    public static void main(String[] strings) throws Exception {
        Map<Tuple<String, Double>, Tuple<Integer, String>> map = (in) -> new Tuple<>();
        MyTypeInfo ti = extract(map);
    }
}

by using the solution described here: http://stackoverflow.com/questions/21887358/reflection-type-inference-on-java-8-lambdas

My question is: Why does the method_info of a synthetic lambda$xxx method does not contain a generic signature anymore? It was a very valuable feature.

Regards,
Timo





Back to the top