private static <T extends DomChildDescriptionImpl> ChildrenDescriptionsHolder<T> internChildrenHolder(XmlFile file, ChildrenDescriptionsHolder<T> holder) { SoftReference<WeakInterner<ChildrenDescriptionsHolder>> ref = file.getUserData(HOLDERS_CACHE); WeakInterner<ChildrenDescriptionsHolder> cache = SoftReference.dereference(ref); if (cache == null) { cache = new WeakInterner<ChildrenDescriptionsHolder>(); file.putUserData(HOLDERS_CACHE, new SoftReference<WeakInterner<ChildrenDescriptionsHolder>>(cache)); } //noinspection unchecked return cache.intern(holder); }