[backport] for PR 3171 missing readOnlyClass methods

this is backport for pull request #3171