Use read-only access for enumerating classes to prevent access denied bugs