private TryCatchStatement createCleanupTryCatch(CleanupBlock block, VariableExpression featureThrowableVar, VariableExpression failedBlock) {
    List<Statement> cleanupStats = new ArrayList<>(block.getAst());
    TryCatchStatement tryCatchStat =
        new TryCatchStatement(
            new BlockStatement(cleanupStats, null),
            ifThrowableIsNotNull(restoreFailedBlock(failedBlock))
        );

    tryCatchStat.addCatch(createHandleSuppressedThrowableStatement(featureThrowableVar));

    return tryCatchStat;
  }
A Spec visitor responsible for most of the rewriting of a Spec's AST.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java