GrStatement (@NotNull GrStatement anchor) { GrBlockStatement blockStatement = GroovyPsiElementFactory.getInstance(anchor.getProject()).createBlockStatement(); blockStatement.getBlock().addStatementBefore(anchor, null); GrBlockStatement newBlockStatement = ((GrBlockStatement)anchor.replace(blockStatement)); return newBlockStatement.getBlock().getStatements()[0]; }