DA/DU changes

Brian Goetz brian.goetz at oracle.com
Sat Nov 12 09:33:57 PST 2011


The likelihood is that the adjustments to DA/DU will also apply to inner classes as well. We are evaluating each of the "differences" between lambdas and inner classes, and for each will have to make a decision on which to make "consistent", and there are some that we will definitely not be able to port back (such as the scoping rules for names).  Note that "it seems inconsistent" is something that will be true about Java always, no matter what we do.  But we can try to pick the inconsistencies that make the least un-sense.  

On Nov 12, 2011, at 6:11 PM, Tomasz Kowalczewski wrote:

> All,
> 
> Will the DA/DU changes be applied to anonymous classes (and possibly
> other places) or will be exclusive to lambda?
> I was playing with the lambda prototype compiled from hg repo (not the
> binary snapshot posted by Maurizio). When checking the DA/DU changes
> made for lambda I did following:
> 
> // Compiles
> Runnable run = () -> { run.run(); };
> 
> // org\tkowalcz\lambda\dadu\RunnableExaple.java:22: error: variable
> run might not have been initialized
> //				run.run();
> //				^
> //1 error
> 
> final Runnable run = new Runnable() {
> 	@Override
> 	public void run() {
> 		run.run();
> 	}
> };
> 
> It seems inconsistent to me.
> 
> -- 
> Tomasz Kowalczewski
> 



More information about the lambda-dev mailing list