AnnotationFinder extends ClassVisitor { public Set<Constructor> getAnnotatedConstructors() { return annotatedConstructors; } AnnotationFinder(ClassLoader classLoader, Collection<Class<? extends Annotation>> annotations); @Override void visit(int version, int access, String name, String signature, String superName, String[] interfaces); @Override AnnotationVisitor visitAnnotation(String desc, boolean visible); @Override FieldVisitor visitField(int access, String name, String desc, String signature, Object value); @Override MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions); Set<Class<?>> getAnnotatedClasses(); Set<Method> getAnnotatedMethods(); Set<Constructor> getAnnotatedConstructors(); Set<Field> getAnnotatedFields();  }
@Test public void testFindAnnotationsOnConstructors() { cp.compile( "package governator.test;" + "import java.util.Collection;" + "public class Foo {" + " @A private Foo() {}" + " @A Foo(String p) {}" + " @A Foo(String[] p) {}" + " @A Foo(Collection<String> p) {}" + " @A Foo(byte p) {}" + "}" ); assertThat(scan("governator.test.Foo", a).getAnnotatedConstructors(), is(Matchers.<Constructor>iterableWithSize(5))); }