void (Project project, GrMethod resultMethod, GrTraitMethod traitMethod) { PsiClass traitClass = traitMethod.getPrototype().getContainingClass(); @NlsSafe StringBuilder builder = new StringBuilder(); builder.append("\nreturn "); builder.append(traitClass.getQualifiedName()); builder.append(".super."); builder.append(traitMethod.getName()); builder.append("("); GrParameter[] parameters = resultMethod.getParameters(); for (GrParameter parameter : parameters) { builder.append(parameter.getName()).append(","); } if (parameters.length > 0) { builder.replace(builder.length() - 1, builder.length(), ")\n"); } else { builder.append(")\n"); } GroovyFile file = GroovyPsiElementFactory.getInstance(project).createGroovyFile(builder, false, null); GrOpenBlock block = resultMethod.getBlock(); block.getNode().addChildren(file.getFirstChild().getNode(), null, block.getRBrace().getNode()); }