boolean (PsiPackage aPackage) { final Project project = aPackage.getProject(); ConcurrentMap<PsiPackage, Boolean> map = project.getUserData(SHOULD_ABBREV_PACK_KEY); if (map == null) { final ConcurrentMap<PsiPackage, Boolean> newMap = ContainerUtil.createConcurrentWeakMap(); map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap); if (map == newMap) { project.getMessageBus().connect().subscribe(ANY_PSI_CHANGE_TOPIC, new AnyPsiChangeListener() { @Override public void beforePsiChanged(boolean isPhysical) { if (isPhysical) newMap.clear(); } }); } } Boolean ret = map.get(aPackage); if (ret != null) return ret; ret = scanPackages(aPackage, 1); map.put(aPackage, ret); return ret; }