The implementation of default methods

Doug Lea dl at cs.oswego.edu
Sat Dec 15 09:14:46 PST 2012


On 12/15/12 10:56, Brian Goetz wrote:
> For Iterator.remove, I think the real constraint is: the JDK must provide *a*
> default implementation (since this is only an issue for compatibility across
> JDKs).  Since the only reasonable default would be to throw something, we might
> as well specify what is thrown, since this degree of freedom serves noone: the
> JDK must provide a default that throws UOE.

Pedantic mode: In which case the javadoc should say "always throws UOE".

To be even more pedantic, it should say "always throws UOE without
first doing anything else you should know about, like erasing your
disk".  But frame-axioms are usually implicit in these kinds of specs.
(But not always...)

-Doug




More information about the lambda-libs-spec-observers mailing list