public CachedClass(Class klazz, ClassInfo classInfo) { cachedClass = klazz; this.classInfo = classInfo; isArray = klazz.isArray(); isPrimitive = klazz.isPrimitive(); modifiers = klazz.getModifiers(); isInterface = klazz.isInterface(); isNumber = Number.class.isAssignableFrom(klazz); for (CachedClass inf : getInterfaces()) { ReflectionCache.isAssignableFrom(klazz, inf.cachedClass); } for (CachedClass cur = this; cur != null; cur = cur.getCachedSuperClass()) { ReflectionCache.setAssignableFrom(cur.cachedClass, klazz); } }
public CachedClass(Class klazz, ClassInfo classInfo) { cachedClass = klazz; this.classInfo = classInfo; isArray = klazz.isArray(); isPrimitive = klazz.isPrimitive(); modifiers = klazz.getModifiers(); isInterface = klazz.isInterface(); isNumber = Number.class.isAssignableFrom(klazz); for (Iterator it = getInterfaces().iterator(); it.hasNext(); ) { CachedClass inf = (CachedClass) it.next(); ReflectionCache.isAssignableFrom(klazz, inf.cachedClass); } for (CachedClass cur = this; cur != null; cur = cur.getCachedSuperClass()) { ReflectionCache.setAssignableFrom(cur.cachedClass, klazz); } }
public CachedClass(Class klazz, ClassInfo classInfo) { cachedClass = klazz; this.classInfo = classInfo; isArray = klazz.isArray(); isPrimitive = klazz.isPrimitive(); modifiers = klazz.getModifiers(); isInterface = klazz.isInterface(); isNumber = Number.class.isAssignableFrom(klazz); for (Iterator it = getInterfaces().iterator(); it.hasNext(); ) { CachedClass inf = (CachedClass) it.next(); ReflectionCache.isAssignableFrom(klazz, inf.cachedClass); } for (CachedClass cur = this; cur != null; cur = cur.getCachedSuperClass()) { ReflectionCache.setAssignableFrom(cur.cachedClass, klazz); } }
public CachedClass(Class klazz, ClassInfo classInfo) { cachedClass = klazz; this.classInfo = classInfo; isArray = klazz.isArray(); isPrimitive = klazz.isPrimitive(); modifiers = klazz.getModifiers(); isInterface = klazz.isInterface(); isNumber = Number.class.isAssignableFrom(klazz); for (CachedClass inf : getInterfaces()) { ReflectionCache.isAssignableFrom(klazz, inf.cachedClass); } for (CachedClass cur = this; cur != null; cur = cur.getCachedSuperClass()) { ReflectionCache.setAssignableFrom(cur.cachedClass, klazz); } }
/** * Initialization involves making calls back to ReflectionCache to popuplate * the "assignable from" structure. * Package scoped (like our constructor) because ReflectionCache is really the * only place we should be called from. * * We don't need to be synchronized here because ReflectionCache is careful to * make sure we're called exactly once. * By the same token we could however safely lock ourself. * But the idea here is to take out the bad locks. */ final void initialize() { for (Iterator it = getInterfaces().iterator(); it.hasNext(); ) { CachedClass inf = (CachedClass) it.next(); ReflectionCache.isAssignableFrom(cachedClass, inf.cachedClass); } // If we *were* going to lock the Class/CachedClass of our parents, // it would probably be a better idea to climb to the top then do the // locking from the top down to here. // But that shouldn't really be necessary since this is the wrong place for that. // One of the keys is probably that the constructor and initialization need to be // separated (like with MetaClassImpl). for (CachedClass cur = this; cur != null; cur = cur.getCachedSuperClass()) { ReflectionCache.setAssignableFrom(cur.cachedClass, cachedClass); } }