Simplifying constructor pattern matching to use instanceof