boolean (GrExpression operand, StringBuilder builder) { if (!(operand instanceof GrMethodCallExpression)) return false; final GrExpression expression = ((GrMethodCallExpression)operand).getInvokedExpression(); if (!(expression instanceof GrReferenceExpression refExpr)) return false; final GrExpression qualifier = refExpr.getQualifierExpression(); if (qualifier == null) return false; final GroovyResolveResult[] results = refExpr.multiResolve(false); if (results.length != 1) return false; final PsiElement element = results[0].getElement(); if (!(element instanceof PsiMethod method)) return false; final PsiClass objectClass = JavaPsiFacade.getInstance(operand.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, operand.getResolveScope()); if (objectClass == null) return false; final PsiMethod[] toStringMethod = objectClass.findMethodsByName("toString", true); if (MethodSignatureUtil.isSubsignature(toStringMethod[0].getHierarchicalMethodSignature(), method.getHierarchicalMethodSignature())) { builder.append(START_BRACE).append(qualifier.getText()).append(END_BRACE); return true; } return false; }