long (@NotNull Object dependency) { if (dependency instanceof PsiDirectory) { return myManager.getModificationTracker().getModificationCount(); } if (dependency instanceof PsiElement) { PsiElement element = (PsiElement)dependency; if (!element.isValid()) return -1; PsiFile containingFile = element.getContainingFile(); if (containingFile != null) return containingFile.getModificationStamp(); } if (dependency == PsiModificationTracker.MODIFICATION_COUNT || dependency == PSI_MOD_COUNT_OPTIMIZATION) { return myManager.getModificationTracker().getModificationCount(); } return super.getTimeStamp(dependency); }