void (@NotNull PsiLiteralExpression expression, @NotNull TokenConsumer consumer) { String text; if (!ExpressionUtils.hasStringType(expression)) { text = null; } else if (expression.isTextBlock()) { text = expression.getText(); if (text.length() < 7) return; text = text.substring(3, text.length() - 3); } else { text = PsiLiteralUtil.getStringLiteralContent(expression); } if (StringUtil.isEmpty(text) || text.length() <= 2) { // optimization to avoid expensive injection check return; } if (InjectedLanguageManager.getInstance(expression.getProject()).getInjectedPsiFiles(expression) != null) return; final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(skipParenthesizedExprUp(expression), PsiModifierListOwner.class); if (listOwner != null && AnnotationUtil.isAnnotated(listOwner, AnnotationUtil.NON_NLS, AnnotationUtil.CHECK_EXTERNAL)) { PsiElement targetElement = skipParenthesizedExprUp(getCompleteStringValueExpression(expression)); if (listOwner instanceof PsiMethod) { if (Arrays.stream(PsiUtil.findReturnStatements(((PsiMethod)listOwner))).map(s -> s.getReturnValue()).anyMatch(e -> e == targetElement)) { return; } } else if (listOwner instanceof PsiVariable && ((PsiVariable)listOwner).getInitializer() == targetElement) { return; } } if (!text.contains("\\")) { consumer.consumeToken(expression, PlainTextSplitter.getInstance()); } else { processTextWithEscapeSequences(expression, text, consumer); } }