GROOVY-5249 ClassInfo refactoring: extract method isOkToReturnWeakMetaClass and use it also in getMetaClass() method