Primitives in Generics (+ the meaning of this)

Brian Goetz brian.goetz at oracle.com
Fri Jul 16 20:13:47 PDT 2010


> There were many discussions previously about what 'this' should refer to.
> Many times the lambdas/closures/whatever were based on interfaces or
> function types. If I'm understanding things correctly it is now a goal to
> allow abstract classes which have a SAM to be expressed as a lambda.

This is correct.  In my survey through several code bases, many useful SAM 
types are abstract classes.  My experience bears this out; it is common for 
SAM types to start life as interfaces but then evolve to abstract classes with 
a few infrequently used methods which have default (usually empty) bodies.  It 
would be nice to say "only interfaces" but my code survey tells me this is not 
likely to fly.

It remains to be seen whether the restriction of "only no-arg constructors for 
abstract classes" will hold as the next defensible boundary.



More information about the lambda-dev mailing list