Default method survey results

"Zdeněk Troníček" tronicek at fit.cvut.cz
Sat Aug 18 22:00:53 PDT 2012


Errata: loosen preconditions and strengthen postconditions.


"Zdeněk Troníček" napsal(a):
> Javadoc may strengthen preconditions and loosen postconditions. So,
> strictly speaking, we can declare remove() that throws UOE and define the
> contract as "may throw UOE or remove the last element". It has the same
> logic as if you declare the class GrObject, its subclasses Ellipse and
> Rectangle, and then implemented the draw method in GrObject so that it
> draws rectangle and argue that it follows the contract (that could be "it
> draws a shape").
> Although technically this follows the substitution principle, I do not
> think this is a good design.



More information about the lambda-dev mailing list