InvisibleAbstractMethod

From APIDesign

Revision as of 17:41, 9 March 2012 by JaroslavTulach (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Having an abstract class with package private abstract method effectively prevents anyone to subclass it. That can be considered as good API design pattern, especially if that is something one starts with.

However it can also turn into a huge anti-pattern. Adding first package private abstract method into an abstract class is in fact an incompatible change. If the class used to be subclassable before, this prevents it and as such classes that used to compile may compile no longer.

The hidden catch is that tools like Sigtest are unlikely to catch this situation, as they don't care about package private methods!

TBD

Personal tools
buy