root)));
if (!isInterface) {
// The test.
IfStatement test = ast.newIfStatement();
InfixExpression testExpression = ast.newInfixExpression();
testExpression.setLeftOperand(ast.newSimpleName(CHECKPOINT_NAME));
testExpression.setOperator(InfixExpression.Operator.NOT_EQUALS);
testExpression.setRightOperand(ast.newSimpleName("checkpoint"));
test.setExpression(testExpression);
// The "then" branch of the test.
Block thenBranch = ast.newBlock();
test.setThenStatement(thenBranch);
Block body = ast.newBlock();
body.statements().add(test);
method.setBody(body);
// Backup the old checkpoint.
VariableDeclarationFragment fragment = ast
.newVariableDeclarationFragment();
fragment.setName(ast.newSimpleName("oldCheckpoint"));
fragment.setInitializer(ast.newSimpleName(CHECKPOINT_NAME));
VariableDeclarationStatement tempDeclaration = ast
.newVariableDeclarationStatement(fragment);
tempDeclaration.setType(createType(ast, checkpointType));
thenBranch.statements().add(tempDeclaration);
// Record the old checkpoint if the new checkpoint is not null.
// If it is null, it is impossible to roll back to the previous
// checkpoint.
IfStatement testNewCheckpoint = ast.newIfStatement();
InfixExpression testNull = ast.newInfixExpression();
testNull.setLeftOperand(ast.newSimpleName("checkpoint"));
testNull.setOperator(InfixExpression.Operator.NOT_EQUALS);
testNull.setRightOperand(ast.newNullLiteral());
testNewCheckpoint.setExpression(testNull);
Block testNewCheckpointBody = ast.newBlock();
testNewCheckpoint.setThenStatement(testNewCheckpointBody);