Object (PsiVariable variable, ConstValueComputer computer, Set<PsiVariable> visitedVars) { boolean physical = variable.isPhysical(); Object cached = (physical ? myVarToConstValueMap1 : myVarToConstValueMap2).get(variable); if (cached == NULL) return null; if (cached != null) return cached; Object result = computer.execute(variable, visitedVars); (physical ? myVarToConstValueMap1 : myVarToConstValueMap2).put(variable, result != null ? result : NULL); return result; }