Hi Emmanuel,
Quote:
What would be the alternative you propose? duplication?
I don't like it either, but at least you get some choice.
Quote:
The reason the spec is written like that is because from a OO point of view, this is the right thing to do.
I agree with you that this would be needed for clean code, I am just arguing that maybe you are enforcing a best practice.
Maybe it's a good thing, but if someday someone needs otherwise he will be stuck. Also in OO you you may override a method with a "throw new UnsupportedException", quite ugly but permitted.
I think it should be the default behavior, but you could consider a way to optionally disable it.
What about an annotation similar to
Code:
java.lang.annotation.Inherited
?
You add a new "marking annotation", then you could add it to all default validators and recommend it to be used on all user-provided validator.
You could also make a default wrapping validator which is not marked, so people could "wrap" standard validators to disable inheritance; something like the "@Properties" in your examples but accepting a single validator instead of an array.
regards,
Sanne