[jdom-interest] Request -- please allow all XML 1.1 conformant text in Element.se tText()

Chris B. chris at tech.com.au
Sat Mar 6 05:57:27 PST 2004

Elliotte Rusty Harold wrote:

> I have. Have you? Java assertions do not meet Meyer's design by 
> contract criteria. 

They are the closest thing we've got.

> More importantly Meyer allows only one reason for turning off 
> precondition checking, performance. (A point on which I disagree with 
> him.) He does not believe clients should be able to turn off 
> preconditions in order to change the semantics of a class as is being 
> requested here.

I havn't heard anybody saying they want to change the semantics of JDOM. 
They only want to force JDOM to assume that their data is correct 
without having it re-checked.

>> BTW, private members are evil. Everything should be protected. It's 
>> not up to you to decide how somebody may want to extend your object.
> Actually it is. As Joshua Bloch wrote, design for subclassing or 
> prohibit it.

> JDOM's had a lot of problems over the years because we failed to 
> follow this rule rigorously. The protected API is no less of a promise 
> to clients than the public API. Indeed allowing subclasses to change 
> too much violates the promises made in the public API.

Since Java doesn't have inherited preconditions, you're just going to 
have to trust that people who sub-class to not violate the public API. 
But as Bertrand Meyer would say, it's not up to you to predict and 
prevent people from extending your class.

More information about the jdom-interest mailing list