private CatchStatement createHandleSuppressedThrowableStatement(VariableExpression featureThrowableVar) {
    Parameter catchParameter = new Parameter(nodeCache.Throwable, SpockNames.SPOCK_TMP_THROWABLE);

    BinaryExpression featureThrowableNotNullExpr = AstUtil.createVariableIsNotNullExpression(featureThrowableVar);

    List<Statement> addSuppressedStats =
      singletonList(new ExpressionStatement(
        createDirectMethodCall(
          featureThrowableVar,
          nodeCache.Throwable_AddSuppressed,
          new ArgumentListExpression(new VariableExpression(catchParameter)))));
    List<Statement> throwFeatureStats =
      singletonList(new ThrowStatement(new VariableExpression(catchParameter)));

    IfStatement ifFeatureNotNullStat = new IfStatement(new BooleanExpression(featureThrowableNotNullExpr),
      new BlockStatement(addSuppressedStats, null),
      new BlockStatement(throwFeatureStats, null));

    return new CatchStatement(catchParameter,
      new BlockStatement(
        singletonList(ifFeatureNotNullStat),
        null));
  }
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