boolean (PsiElement element) { final PsiJavaToken token; if (element instanceof PsiJavaToken) { token = (PsiJavaToken)element; } else { final PsiElement prevSibling = element.getPrevSibling(); if (prevSibling instanceof PsiJavaToken) { token = (PsiJavaToken)prevSibling; } else { return false; } } final PsiElement parent = element.getParent(); if (!(parent instanceof PsiPolyadicExpression polyadicExpression)) { return false; } final PsiType type = polyadicExpression.getType(); if (type == null || type.equalsToText(JAVA_LANG_STRING)) { // handled by JoinConcatenatedStringLiteralsIntention return false; } final PsiPolyadicExpression subexpression = getSubexpression(polyadicExpression, token); if (subexpression == null) { return false; } if (!isPartOfLargerExpression(polyadicExpression)) { // handled by ConstantExpressionIntention return false; } if (!PsiUtil.isConstantExpression(subexpression)) { return false; } final Object value = ExpressionUtils.computeConstantExpression(subexpression); return value != null; }