Deprecate isValidClass

Fixes #2374