boolean (PsiMethod method) { final PsiType returnType = method.getReturnType(); final PsiCodeBlock body = method.getBody(); final PsiStatement statement = ControlFlowUtils.getOnlyStatementInBlock(body); if (statement == null) { return false; } if (PsiTypes.voidType().equals(returnType)) { if (!(statement instanceof PsiExpressionStatement expressionStatement)) { return false; } final PsiExpression expression = expressionStatement.getExpression(); return isCallToOverloadedMethod(expression, method); } else { if (!(statement instanceof PsiReturnStatement returnStatement)) { return false; } final PsiExpression returnValue = returnStatement.getReturnValue(); return isCallToOverloadedMethod(returnValue, method); } }