Public defender methods and static inner classes in interfaces?

Andrew Thompson lordpixel+lamda-dev at mac.com
Wed Sep 1 19:58:49 PDT 2010


On Aug 31, 2010, at 10:56 PM, Kevin Bourrillion wrote:

> It's a bad idea, because nothing will stop you from creating another class called Trait in another file in that package, and which Trait.class you'll actually end up with is nondeterministic!


Yikes! That's a really good point. Whichever file gets compiled last wins I suppose. That's a fairly major hole they left!

On the other hand, if this is a de-sugaring done by the compiler then a unique class name could easily be generated by the compiler, using a scheme similar to the one used for static inner classes (but obviously not identical to the naming scheme used there, so as to avoid collisions). 

For example 

whatever.package.Example$$Trait 

would do, no?

AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside

	(see you later space cowboy, you can't take the sky from me)




More information about the lambda-dev mailing list