On 01/16/2013 05:58 PM, Joe Darcy wrote:
On 1/16/2013 8:32 AM, Florian Weimer wrote:
On 01/16/2013 05:27 PM, Brian Goetz wrote:
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.
I don't think run-time behavior should depend on optional annotations
documenting design intent (like @Override).
Supporting the discovery of functional interfaces is a good idea. But
a method like Class#isFunctionalInterface() would sever this purpose
better than an entirely optional annotation.
A method like Class#isFunctionalInterface is planned too for later in
JDK 8.
I can imagine that a method like that would be useful if also
accompanied with a method like:
Class#getFunctionalInterfaceMethod()
Regards, Peter
-Joe