@FunctionalInterface implications

Kevin Bourrillion kevinb at google.com
Fri Nov 22 19:05:31 PST 2013


Another example: Guava's Predicate, Function, etc. will probably have to
extend their JDK counterparts as a partially-helpful transitional measure,
for who knows how long before they can be removed.


On Fri, Nov 22, 2013 at 8:32 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> Function is extended by BinaryOperator, also a functional interface,
> which specializes its type parameters.  I think that's a fine pattern.
>
> More generally, its perfectly fine for an interface to extend a
> functional interface but not itself be a functional interface.  See
> Node.Builder inside the Stream package, for example.
>
> On 11/22/2013 7:50 PM, Richard Warburton wrote:
> > Hi,
> >
> > If the intent of an interface marked with @FunctionalInterface is to be
> > used as such then should it ever be extended by another interface?
> >
> > I appreciate there are probably enough complex interactions that
> generating
> > a compile error if this happens would be too restrictive but what about
> > 'morally' or as a guideline?
> >
> > regards,
> >
> >    Richard Warburton
> >
> >    http://insightfullogic.com
> >    @RichardWarburto <http://twitter.com/richardwarburto>
> >
>
>


-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com


More information about the lambda-dev mailing list