private void setMetaClass ( Class theClass , MetaClass oldMc , MetaClass newMc ) { final ClassInfo info = ClassInfo . getClassInfo ( theClass ) ; MetaClass mc = null ; info . lock ( ) ; try { mc = info . getStrongMetaClass ( ) ; info . setStrongMetaClass ( newMc ) ; } finally { info . unlock ( ) ; } if ( ( oldMc == null && mc != newMc ) || ( oldMc != null && mc != newMc && mc != oldMc ) ) { fireConstantMetaClassUpdate ( null , theClass , mc , newMc ) ; } }
if oldMc is null newMc will replace whatever meta class was used before . if oldMc is not null then newMc will be used only if he stored mc is the same as oldMc