Javadoc (b116) lacks @FunctionalInterface on Observer signature

Zhong Yu zhong.j.yu at gmail.com
Fri Nov 22 09:29:35 PST 2013


On Thu, Nov 21, 2013 at 9:43 PM, Joe Darcy <joe.darcy at oracle.com> wrote:
> On 11/21/2013 07:40 PM, Paul Benedict wrote:
>> Look at, Closeable, as an example. You removed the
>> @FunctionalInterface annotation but the javadocs still report it as a
>> functional interface in the class description.
>>
>> http://download.java.net/jdk8/docs/api/java/io/Closeable.html
>
> Yes, that is the correct and expected outcome.
>
> The type java.io.Closeable meets the JLS definition of a functional
> interface and gets reported accordingly by javac. However, it is not
> morally a functional interface so it no longer has the
> @FunctionalInterface annotation, an annotation which indicates
> intentions towards usage and interface evolution.

How it is related to interface evolution? Adding an abstract method to
an interface will always break a lot of things. You can do that if the
interface is in-house where all implementations can be refactored. If
the interface is public with lots of 3rd party implementations, you
simply cannot do that. None of these has anything to do with how many
abstract methods the interface had, or whether it was a functional
interface or not.

I still have no idea how the annotation is supposed to help us. Can
anyone provide a concrete use case for @FunctionalInterface?

Zhong Yu


More information about the lambda-dev mailing list