Request for Review : CR#8004015 : Add interface extends and defaults for basic functional interfaces

Florian Weimer fweimer at
Tue Nov 27 12:16:47 UTC 2012

On 11/27/2012 03:12 AM, Mike Duigou wrote:

> In the original patch which added the basic lambda functional interfaces, CR#8001634 [1], none of the interfaces extended other interfaces. The reason was primarily that the javac compiler did not, at the time that 8001634 was proposed, support extension methods. The compiler now supports adding of method defaults so this patch improves the functional interfaces by filing in the inheritance hierarchy.
> Adding the parent interfaces and default methods allows each functional interface to be used in more places. It is especially important for the functional interfaces which support primitive types, IntSupplier, IntFunction, IntUnaryOperator, IntBinaryOperator, etc. We expect that eventually standard implementations of these interfaces will be provided for functions like max, min, sum, etc. By extending the reference oriented functional interfaces such as Function, the primitive implementations can be used with the boxed primitive types along with the primitive types for which they are defined.

+public interface DoubleBinaryOperator extends BinaryOperator<Double> {

Doesn't the extends go in the wrong direction?  Not every 
BinaryOperator<Double> can be be used as a DoubleBinaryOperator because 
of null values.  I think the documentation should reflect that.

Florian Weimer / Red Hat Product Security Team

More information about the core-libs-dev mailing list