Improve diagnostic messages in ReflectionUtils. Update test cases