Please override `copy()`, `duplicate()`, `retain()`, and `retain(int)` to return the self type.  You'll also have to do the same for all its subtypes, because Java doesn't have the notation for referring to the self type, as you know.