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 guard against infinite recursion case in ClassInfo.incVersionForDerivedOrImplementingClasses
GROOVY-5249 Add null checks for rare case when CachedClass.getTheClass() returns null