Bug in javac and eclipse ??

Remi Forax forax at univ-mlv.fr
Tue Jan 21 14:23:18 PST 2014


(CC lambda-dev)
This code do not compile neither with Eclipse nor with javac, but I 
think that both are wrong.

public class ReferenceProblem {
   static class A {
     public A(Runnable r) { }
   }

   static final A constant = new A(() -> {
     System.out.println(constant);
   });
}

javac talks about 'self reference' but there is no self reference here, 
a lambda is a delayed computation.
15.27.2 only concern local variables, so I don't think this code should 
be rejected.

cheers,
Rémi



More information about the lambda-dev mailing list