parameters.addAll(new ArrayList<Parameter>(Arrays.asList(methodNode.getParameters())));
final List<BooleanExpression> booleanExpressions = ExpressionUtils.getBooleanExpression(closureExpression);
if (booleanExpressions == null || booleanExpressions.isEmpty()) return;
BlockStatement closureBlockStatement = (BlockStatement) closureExpression.getCode();
BlockStatement newClosureBlockStatement = TryCatchBlockGenerator.generateTryCatchBlock(
isPostcondition ? ClassHelper.makeWithoutCaching(PostconditionViolation.class) : ClassHelper.makeWithoutCaching(PreconditionViolation.class),
"<" + annotationNode.getClassNode().getName() + "> " + classNode.getName() + "." + methodNode.getTypeDescriptor() + " \n\n",
AssertStatementCreationUtility.getAssertionStatemens(booleanExpressions)
);
newClosureBlockStatement.setSourcePosition(closureBlockStatement);
ClosureExpression rewrittenClosureExpression = new ClosureExpression(parameters.toArray(new Parameter[parameters.size()]), newClosureBlockStatement);
rewrittenClosureExpression.setSourcePosition(closureExpression);
rewrittenClosureExpression.setDeclaringClass(closureExpression.getDeclaringClass());
rewrittenClosureExpression.setSynthetic(true);
rewrittenClosureExpression.setVariableScope(correctVariableScope(closureExpression.getVariableScope(), methodNode));
rewrittenClosureExpression.setType(closureExpression.getType());
boolean isConstructor = methodNode instanceof ConstructorNode;
ClassNode closureClassNode = contractClosureWriter.createClosureClass(classNode, methodNode, rewrittenClosureExpression, isPostcondition && !isConstructor, isPostcondition && !isConstructor, Opcodes.ACC_PUBLIC);
classNode.getModule().addClass(closureClassNode);
final ClassExpression value = new ClassExpression(closureClassNode);
value.setSourcePosition(annotationNode);
BlockStatement value1 = TryCatchBlockGenerator.generateTryCatchBlockForInlineMode(
isPostcondition ? ClassHelper.makeWithoutCaching(PostconditionViolation.class) : ClassHelper.makeWithoutCaching(PreconditionViolation.class),
"<" + annotationNode.getClassNode().getName() + "> " + classNode.getName() + "." + methodNode.getTypeDescriptor() + " \n\n",
AssertStatementCreationUtility.getAssertionStatemens(booleanExpressions)
);
value1.setNodeMetaData(META_DATA_USE_EXECUTION_TRACKER, validator.isMethodCalls());
value.setNodeMetaData(META_DATA_ORIGINAL_TRY_CATCH_BLOCK, value1);
annotationNode.setMember(CLOSURE_ATTRIBUTE_NAME, value);
markClosureReplaced(methodNode);