boolean (@NotNull PsiTemplateExpression expression) { PsiExpression processor = PsiUtil.skipParenthesizedExprDown(expression.getProcessor()); if (!JavaPsiStringTemplateUtil.isStrTemplate(processor)) return false; PsiLiteralExpression literalExpression = expression.getLiteralExpression(); if (literalExpression != null) { literalExpression.accept(this); return true; } PsiTemplate template = expression.getTemplate(); if (template == null) { pushUnknown(); return true; } PsiType stringType = expression.getType(); if (stringType == null) return false; TypeConstraint constraint = TypeConstraints.exact(stringType); List<@NotNull PsiExpression> expressions = template.getEmbeddedExpressions(); List<@NotNull PsiFragment> fragments = template.getFragments(); int count = expressions.size(); if (count + 1 != fragments.size()) return false; for (int i = 0; i < count; i++) { PsiFragment fragment = fragments.get(i); Object value = fragment.getValue(); if (value != null) { addInstruction(new PushValueInstruction(DfTypes.referenceConstant(value, stringType))); } else { pushUnknown(); } if (i > 0) { addInstruction(new StringConcatInstruction(null, constraint)); } PsiExpression embeddedExpression = expressions.get(i); if (embeddedExpression instanceof PsiEmptyExpressionImpl) { addInstruction(new PushValueInstruction(DfTypes.NULL)); } else { embeddedExpression.accept(this); } addInstruction(new StringConcatInstruction(null, constraint)); } PsiFragment lastFragment = fragments.get(count); Object value = lastFragment.getValue(); if (value != null) { addInstruction(new PushValueInstruction(DfTypes.referenceConstant(value, stringType))); } else { pushUnknown(); } if (count > 0) { addInstruction(new StringConcatInstruction(new JavaExpressionAnchor(expression), constraint)); } return true; }