Object (@NotNull PsiVariable variable, @NotNull ConstValueComputer computer, Set<PsiVariable> visitedVars) { boolean physical = variable.isPhysical(); AtomicReference<Map<PsiVariable, Object>> ref = physical ? myVarToConstValueMapPhysical : myVarToConstValueMapNonPhysical; Map<PsiVariable, Object> map = ref.get(); if (map == null) { map = ConcurrencyUtil.cacheOrGet(ref, CollectionFactory.createConcurrentWeakMap()); } Object cached = map.get(variable); if (cached == NULL) { return null; } if (cached != null) { return cached; } Object result = computer.execute(variable, visitedVars); map.put(variable, result == null ? NULL : result); return result; }