Search in sources :

Example 1 with ContractElement

use of org.apache.groovy.contracts.annotations.meta.ContractElement in project groovy by apache.

the class AnnotationProcessorVisitor method visitInterfaces.

private void visitInterfaces(final ClassNode classNode, final ClassNode[] interfaces) {
    for (ClassNode interfaceClassNode : interfaces) {
        List<MethodNode> methodNodes = new ArrayList<MethodNode>(interfaceClassNode.getMethods());
        // @ContractElement annotations are by now only supported on method interfaces
        for (MethodNode interfaceMethodNode : methodNodes) {
            MethodNode implementingMethodNode = classNode.getMethod(interfaceMethodNode.getName(), interfaceMethodNode.getParameters());
            if (implementingMethodNode == null)
                continue;
            final List<AnnotationNode> annotationNodes = AnnotationUtils.hasMetaAnnotations(interfaceMethodNode, ContractElement.class.getName());
            handleInterfaceMethodNode(classNode, implementingMethodNode, annotationNodes);
        }
        visitInterfaces(classNode, interfaceClassNode.getInterfaces());
    }
}
Also used : ClassNode(org.codehaus.groovy.ast.ClassNode) ContractElement(org.apache.groovy.contracts.annotations.meta.ContractElement) MethodNode(org.codehaus.groovy.ast.MethodNode) AnnotationNode(org.codehaus.groovy.ast.AnnotationNode) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 ContractElement (org.apache.groovy.contracts.annotations.meta.ContractElement)1 AnnotationNode (org.codehaus.groovy.ast.AnnotationNode)1 ClassNode (org.codehaus.groovy.ast.ClassNode)1 MethodNode (org.codehaus.groovy.ast.MethodNode)1