Use freezeObject for Enumeration classes

For #1736