void (@NotNull GrBinaryExpression expression) { final GrExpression left = expression.getLeftOperand(); GrExpression right = expression.getRightOperand(); final PsiType ltype = left.getType(); final PsiElement token = expression.getOperationToken(); final IElementType op = expression.getOperationTokenType(); if (op == GroovyTokenTypes.mREGEX_FIND) { builder.append(GroovyCommonClassNames.JAVA_UTIL_REGEX_PATTERN).append(".compile("); if (right != null) { right.accept(this); } builder.append(").matcher("); left.accept(this); builder.append(')'); return; } if (op == GroovyTokenTypes.mREGEX_MATCH) { builder.append(GroovyCommonClassNames.JAVA_UTIL_REGEX_PATTERN).append(".matches("); if (right != null) { right.accept(this); } builder.append(", "); left.accept(this); builder.append(')'); return; } if ((op == GroovyTokenTypes.mEQUAL || op == GroovyTokenTypes.mNOT_EQUAL) && (GrInspectionUtil.isNull(left) || right != null && GrInspectionUtil.isNull(right))) { writeSimpleBinaryExpression(token, left, right); return; } if (op == GroovyTokenTypes.kIN && right instanceof GrReferenceExpression && InheritanceUtil.isInheritor(right.getType(), CommonClassNames.JAVA_LANG_CLASS)) { final PsiType type = com.intellij.psi.util.PsiUtil.substituteTypeParameter(right.getType(), CommonClassNames.JAVA_LANG_CLASS, 0, true); writeInstanceof(left, type, expression); return; } if (shouldNotReplaceOperatorWithMethod(ltype, right, op)) { writeSimpleBinaryExpression(token, left, right); return; } final GroovyResolveResult resolveResult = PsiImplUtil.extractUniqueResult(PsiUtilKt.multiResolve(expression)); final PsiElement resolved = resolveResult.getElement(); if (resolved instanceof PsiMethod) { if (right == null) { right = factory.createExpressionFromText("null"); } if (op == GroovyTokenTypes.mNOT_EQUAL && "equals".equals(((PsiMethod)resolved).getName())) { builder.append('!'); } invokeMethodOn( ((PsiMethod)resolved), left, new GrExpression[]{right}, GrNamedArgument.EMPTY_ARRAY, GrClosableBlock.EMPTY_ARRAY, resolveResult.getSubstitutor(), expression ); if (op == GroovyTokenTypes.mGE) { builder.append(" >= 0"); } else if (op == GroovyTokenTypes.mGT) { builder.append(" > 0"); } else if (op == GroovyTokenTypes.mLT) { builder.append(" < 0"); } else if (op == GroovyTokenTypes.mLE) builder.append(" <= 0"); } else { writeSimpleBinaryExpression(token, left, right); } }