JDK 8 RFR for JDK-8022658: Revisit FunctionalInterface on some core libs types
Joe Darcy
joe.darcy at oracle.com
Mon Oct 21 18:53:20 UTC 2013
I was on the fence for Iterable too. Other opinions?
Thanks,
-Joe
On 10/21/2013 11:47 AM, Brian Goetz wrote:
> Of these, the only one I might question is Iterable. While it is
> commonly used as a mixin like Closeable or Flushable, unlike the
> others, Iterables also make sense to stand on their own, and there are
> some libraries that truck entirely in Iterable to perform stream-like
> behavior (being the least-common-denominator "access to elements"
> type.) But, I can go either way on this.
>
> On 10/21/2013 2:16 PM, Joe Darcy wrote:
>> Hello,
>>
>> Earlier in JDK 8, various core library classes were annotated with the
>> @FunctionalInterface annotation (JDK-8005623 Retrofit
>> FunctionalInterface annotations to core platform interfaces). As
>> experience has been gained with the feature, the time has come to
>> revisit some of those annotations under issue
>>
>> JDK-8022658: Revisit FunctionalInterface on some core libs types
>>
>> In brief, I propose removing @FunctionalInterface from the following six
>> types:
>>
>> src/share/classes/java/io/Closeable.java
>> src/share/classes/java/io/Flushable.java
>> src/share/classes/java/lang/AutoCloseable.java
>> src/share/classes/java/lang/Comparable.java
>> src/share/classes/java/lang/Iterable.java
>> src/share/classes/java/lang/Readable.java
>>
>> In these cases, the single method of the interface is more so a
>> mix-in/trait like feature and not readily usable standalone in a lambda
>> expression. Patch below.
>>
>> Thanks,
>>
>> -Joe
>>
More information about the core-libs-dev
mailing list