Object (@NotNull PsiExpression e, @NotNull Configuration.DfaOption dfaOption, boolean includeUncomputablesAsLiterals, @NotNull List<? super PsiExpression> uncomputables) { ConcurrentMap<PsiElement, Object> map = new ConcurrentHashMap<>(); return myHelper.computeExpression(e, false, new PsiConstantEvaluationHelper.AuxEvaluator() { @Override public @Nullable Object computeExpression(@NotNull PsiExpression o, @NotNull PsiConstantEvaluationHelper.AuxEvaluator auxEvaluator) { PsiType resolvedType = null; if (o instanceof PsiMethodCallExpression c) { PsiMethod m = (PsiMethod)c.getMethodExpression().resolve(); PsiType returnType = m != null ? m.getReturnType() : null; if (returnType != null && !PsiTypes.voidType().equals(returnType)) { // find substitution Object substituted = calcSubstituted(m); if (substituted != null) return substituted; } resolvedType = returnType; } else if (o instanceof PsiReferenceExpression) { PsiElement resolved = ((PsiReferenceExpression)o).resolve(); if (resolved instanceof PsiModifierListOwner) { // find substitution Object substituted = calcSubstituted((PsiModifierListOwner)resolved); if (substituted != null) return substituted; if (resolved instanceof PsiVariable psiVariable) { resolvedType = psiVariable.getType(); Collection<PsiExpression> values; if (dfaOption == Configuration.DfaOption.ASSIGNMENTS) { values = DfaPsiUtil.getVariableAssignmentsInFile(psiVariable, true, o); } else if (dfaOption == Configuration.DfaOption.DFA) { values = DfaUtil.getVariableValues(psiVariable, o); } else if (dfaOption == Configuration.DfaOption.RESOLVE) { PsiExpression initializer = psiVariable.getInitializer(); values = ContainerUtil.createMaybeSingletonList(initializer); } else { values = Collections.emptyList(); } // return the first computed value as far as we do not support multiple injection for (PsiExpression value : values) { Object computedValue = auxEvaluator.computeExpression(value, this); if (computedValue != null) { return computedValue; } } } } } uncomputables.add(o); if (includeUncomputablesAsLiterals) { if (resolvedType != null) { if (PsiTypes.doubleType().isAssignableFrom(resolvedType)) return 1; // magic number! } StringBuilder sb = new StringBuilder(); o.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { if (element instanceof PsiExpressionList) return; if (element instanceof PsiIdentifier) { if (sb.length() > 0) sb.append("."); sb.append(element.getText()); } super.visitElement(element); } }); return sb.toString(); } return null; } @Override public @NotNull ConcurrentMap<PsiElement, Object> getCacheMap(boolean overflow) { return map; } }); }