void (PsiFile file, XmlEntityDecl decl) { synchronized(LOCK) { final Map<String, CachedValue<XmlEntityDecl>> cachingMap = getCachingMap(file); final String name = decl.getName(); if (cachingMap.containsKey(name)) return; final SmartPsiElementPointer declPointer = SmartPointerManager.getInstance(file.getProject()).createSmartPsiElementPointer(decl); cachingMap.put( name, CachedValuesManager.getManager(file.getProject()).createCachedValue(() -> { PsiElement declElement = declPointer.getElement(); if (declElement instanceof XmlEntityDecl && declElement.isValid() && name.equals(((XmlEntityDecl)declElement).getName())) return new CachedValueProvider.Result<>((XmlEntityDecl)declElement, declElement); cachingMap.put(name,null); return new CachedValueProvider.Result<>(null, ModificationTracker.NEVER_CHANGED); }, false )); } }