Lambda proxy class doesn't carry generics information

Remi Forax forax at
Sat Oct 5 04:49:48 PDT 2013

David Gageot [1] talk to me about this issue after my presentation at 
ParisJUG and
I totally forgot to report it.
He said that he is using a framework that uses the generic information 
inserted by javac
(and available by reflection) so he can not retrofit its code that uses 
inner classes to
use lambdas because the generated lambda proxy doesn't carry this 

Here is a small test to see the issue:
public static void main(String[] args) {
     Comparator<String> c = new Comparator<String>() {
       public int compare(String s1, String s2) {
         return s1.compareTo(s2);
     Comparator<String> c2 = (s1, s2) -> s1.compareTo(s2);

System.out.println(Arrays.toString(c.getClass().getGenericInterfaces())); // 
// [interface java.util.Comparator]

I said to him that it was not a bug, but it's less clear to me now :(


More information about the lambda-libs-spec-experts mailing list