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

Chris Hegarty chris.hegarty at oracle.com
Thu Nov 29 14:44:40 UTC 2012


On 11/29/2012 05:50 AM, David Holmes wrote:
> ...
>
> I don't agree that we need to describe what the default implementation
> does, for two reasons:
>
> 1. Normal methods don't usually specify how they are implemented - it is
> an implementation detail. The "default" simply indicates that this
> method does have an implementation and you should expect that
> implementation to obey the contract of the method.
>
> 2. It is not obvious to me that the JDK's choice for a default
> implementation has to be _the_ only possible implementation choice. In
> many/most cases there will be a very obvious choice, but that doesn't
> mean that all suppliers of OpenJDK classes have to be locked in to that
> choice.

This is certainly interesting, and something I've wondered for a while 
now. If java.util.Iterator is to ever be fitted with a default 
implementation of remove ( to throw UnsupportedOperationException ), 
then it would clearly need to be part of the spec, and not an 
implementation detail of OpenJDK. Otherwise, what's the point, every 
developer will still have to implement it because they cannot be 
guaranteed of it's behavior.

-Chris.



More information about the core-libs-dev mailing list