Javadoc (b116) lacks @FunctionalInterface on Observer signature
pbenedict at apache.org
Fri Nov 22 13:21:46 PST 2013
On Fri, Nov 22, 2013 at 2:49 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:
> On Fri, Nov 22, 2013 at 12:39 PM, Paul Benedict <pbenedict at apache.org>
> > The design intent is important to me. I want the compiler to enforce the
> > intent with @FunctionalInterface. Zhong, where you get compiler errors is
> > project specific. Not all consuming code is in the same project. The
> > may not show up until the client uses the upgraded jar.
> In the long history of Java, are there anecdotes that a new method is
> accidentally added to a public interface? Has the experience shown
> that it is worthy of a prevention mechanism (which is far from free)?
I think you're looking at this from the wrong perspective. The idea is to
delineate between explicit and implicit functional interfaces. If a
designer absolutely intends this interface to be the subject of a lambda
assignment target, it makes total sense to use @FunctionalInterface. Other
interfaces -- just by happenstance alone -- may have one method with
intention of adding others later; you can call it a "functional interface"
today but it won't be tomorrow when the design evolves. So in the case of
implicit functional interfaces, use it at your own risk, because tomorrow
you may be out of luck.
> > But I am not sure this thread should be hijacked with that concern. I'd
> No hijacking. The center issue here is what @FunctionalInterface is
> intended for. The discussion goes no where if we are not clear about
OK, but that wasn't my issue. Mine was thinking there was a bug in javadoc.
It turns out Oracle wants to call out implicit functional interfaces, but I
just want them to tweak the message.
More information about the lambda-dev