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

Peter Levart peter.levart at gmail.com
Thu Jan 17 08:07:10 UTC 2013

On 01/17/2013 07:58 AM, Remi Forax wrote:
> On 01/16/2013 11:25 PM, Peter Levart wrote:
>> 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()
> this method may not exist.
Even if isFunctionalInterface() returns true? How? There might be more 
than one (if they can be implemented by a single method), but there 
might exist an algorithm to choose the most appropriate.

Regards, Peter
>> Regards, Peter
>>> -Joe
> Rémi

More information about the core-libs-dev mailing list