void (@NotNull PsiExpression expression) { if (expression instanceof PsiLiteralExpression) return; // inspection disabled for long expressions because of performance issues on // relatively common large string expressions. Object value = computeConstant(expression); if (value == null) return; if (value instanceof PsiField && !(value instanceof PsiEnumConstant)) return; if (value instanceof PsiElement e && expression instanceof PsiReferenceExpression ref && ref.isReferenceTo(e)) return; String valueText = getValueText(value); if (valueText == null || expression.textMatches(valueText)) return; String message = valueText.length() > MAX_RESULT_LENGTH_TO_DISPLAY ? InspectionGadgetsBundle.message("inspection.constant.expression.display.name") : InspectionGadgetsBundle.message("inspection.constant.expression.message", valueText); if (skipIfContainsReferenceExpression && hasReferences(expression)) { if (isOnTheFly) { holder.registerProblem(expression, message, ProblemHighlightType.INFORMATION, new ComputeConstantValueFix(expression, valueText)); } } else { holder.registerProblem(expression, message, new ComputeConstantValueFix(expression, valueText)); } }