boolean (PsiExpression expression, PsiMethodCallExpression formatCall) { PsiExpressionList expressionList = formatCall.getArgumentList(); PsiExpression formatArgument = FormatUtils.getFormatArgument(expressionList); if (PsiTreeUtil.isAncestor(formatArgument, expression, false)) return true; if (!(expression instanceof PsiMethodCallExpression)) return false; PsiExpression[] expressions = formatCall.getArgumentList().getExpressions(); int formatArgumentIndex = ArrayUtil.find(expressions, formatArgument); if (formatArgumentIndex == -1) return false; int expressionIndex = ArrayUtil.find(expressions, expression); if (expressionIndex != formatArgumentIndex + 1 || expressionIndex != expressions.length - 1) return false; PsiMethodCallExpression qualifierCall = MethodCallUtils.getQualifierMethodCall((PsiMethodCallExpression)expression); if (qualifierCall == null || qualifierCall.getTypeArguments().length > 0) return false; PsiExpression qualifier = qualifierCall.getMethodExpression().getQualifierExpression(); if (qualifier == null) return false; PsiClassType type = tryCast(qualifier.getType(), PsiClassType.class); if (type == null || type.isRaw()) return false; PsiMethod method = qualifierCall.resolveMethod(); if (method == null) return false; PsiType returnType = method.getReturnType(); PsiTypeParameter returnTypeParameter = tryCast(PsiUtil.resolveClassInClassTypeOnly(returnType), PsiTypeParameter.class); return returnTypeParameter != null && returnTypeParameter.getOwner() == method && !ContainerUtil.map(method.getParameterList().getParameters(), PsiParameter::getType).contains(returnType); }