JDK 8 code review request for 8005298 Add FunctionalInterface type to the core libraries

Brian Goetz brian.goetz at oracle.com
Wed Jan 16 16:27:42 UTC 2013


Yes it would.  

The primary purpose of this annotation is to *capture design intent*.  It is not required.  The compiler will help you enforce the design intent if you provide it.  The compiler will not synthesize this annotation, since that would be guessing at the design intent.  It is possible to create classfiles that subvert the design intent.  

The point about other languages was simply to point out that the universe of tools that might usefully use this design intent is bigger than sometimes assumed.  

On Jan 16, 2013, at 8:16 AM, Florian Weimer wrote:

> On 01/16/2013 05:08 PM, Brian Goetz wrote:
>> There is a benefit for languages *other* than Java, that can use this as a means to determine whether the interface is suitable for passing to the SAM conversion machinery.
> 
> But this would miss non-annotated classes, wouldn't it?
> 
> (If javac is supposed to synthesize this annotation on interfaces which are of SAM type, but not yet annotated as such, then this should be mentioned in the documentation.)
> 
> -- 
> Florian Weimer / Red Hat Product Security Team




More information about the core-libs-dev mailing list