5 ms·
by allowing subclassing you have a larger contract you have to maintain when you want to make changes to the underlying class: rather than just the public inter
by jjs 16y ago
by allowing subclassing you have a larger contract you have to maintain when you want to make changes to the underlying class: rather than just the public interface, you also need to worry about the protected interface.
In other words, if you allow subclassing, then you also have to worry about the interface that you have explicitly marked visible to subclasses.
Normally a non-problem, by definition.
final is useful when sealing a class that inherits from a parent class with a protected interface, but even if "final" is reduced to an annotation (or even a comment), its presence explicitly limits your end of the API contract.
- swannodette 16y agoThere is no subclassing going on. Take the time to actually read the documentation provided by the link.
- jjs 16y agoThe italicized portion at the top of my comment was a quote from the parent comment.