void (@NotNull PsiMethod method, @Nullable GrExpression caller, GrExpression @NotNull [] exprs, GrNamedArgument @NotNull [] namedArgs, GrClosableBlock @NotNull [] closures, @NotNull PsiSubstitutor substitutor, @NotNull GroovyPsiElement context) { if (method instanceof GrGdkMethod) { if (CustomMethodInvocator.invokeMethodOn(this, (GrGdkMethod)method, caller, exprs, namedArgs, closures, substitutor, context)) return; GrExpression[] newArgs = new GrExpression[exprs.length + 1]; System.arraycopy(exprs, 0, newArgs, 1, exprs.length); if (method.hasModifierProperty(PsiModifier.STATIC)) { newArgs[0] = factory.createExpressionFromText("null"); } else { if (caller == null) { caller = factory.createExpressionFromText("this", context); } newArgs[0] = caller; } invokeMethodOn(((GrGdkMethod)method).getStaticMethod(), null, newArgs, namedArgs, closures, substitutor, context); return; } if (method.hasModifierProperty(PsiModifier.STATIC) && caller == null) { final PsiClass containingClass = method.getContainingClass(); if (containingClass != null && !PsiTreeUtil.isAncestor(containingClass, context, true)) { builder.append(containingClass.getQualifiedName()).append('.'); } } else { //LOG.assertTrue(caller != null, "instance method call should have caller"); if (caller != null) { final boolean castNeeded = GenerationUtil.isCastNeeded(caller, method, this.context); if (castNeeded) { writeCastForMethod(caller, method, context); } caller.accept(this); if (castNeeded) { builder.append(')'); } builder.append('.'); } } builder.append(GroovyToJavaGenerator.convertToJavaIdentifier(method.getName())); final GrSignature signature = GrClosureSignatureUtil.createSignature(method, substitutor); new ArgumentListGenerator(builder, this.context).generate(signature, exprs, namedArgs, closures, context); }