Refactor common annotation functionality to one class instead of two.

There is still the need to move the name clashing check to a decorator
class, because it's not in a good place right where it is now.