merge in a simplified version of @GrailsTypeChecked