Search in sources :

Example 1 with Postcondition

use of org.gcontracts.domain.Postcondition in project gcontracts by andresteingress.

the class EnsuresAnnotationProcessor method process.

@Override
public void process(ProcessingContextInformation processingContextInformation, Contract contract, ClassNode classNode, MethodNode methodNode, BlockStatement blockStatement, BooleanExpression booleanExpression) {
    if (!processingContextInformation.isPostconditionsEnabled())
        return;
    if (booleanExpression == null)
        return;
    final List<ConstructorNode> declaredConstructors = classNode.getDeclaredConstructors();
    contract.postconditions().and(methodNode, new Postcondition(blockStatement, booleanExpression, declaredConstructors.contains(methodNode)));
}
Also used : ConstructorNode(org.codehaus.groovy.ast.ConstructorNode) Postcondition(org.gcontracts.domain.Postcondition)

Aggregations

ConstructorNode (org.codehaus.groovy.ast.ConstructorNode)1 Postcondition (org.gcontracts.domain.Postcondition)1