GROOVY-5249 reduce locking in ClassInfo.getMetaClass(Object)
GROOVY-5249 ClassInfo refactoring: extract method isValidWeakMetaClass and use it also in getMetaClassForClass() method
GROOVY-5249 ClassInfo refactoring: extract method
GROOVY-5249 fix concurrency bug when calling ClassInfo.setWeakMetaClass or setStrongMetaClass
- previously an existing weakMetaClass ManagedReference instance was just forgotten and never cleared.
- call ManagedReference.clear() for possible previous instance in weakMetaClass field
GROOVY-5249: try to reduce the number of data races by reducing the number of reads