protected <A extends Annotation> A getAnnotation(Class<A> annoType, Symbol annotated) { if (!annoType.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annoType); } String name = annoType.getName(); for (Attribute.Compound attr : annotated.getAnnotationMirrors()) { if (name.equals(attr.type.tsym.flatName().toString())) { return AnnotationProxyMaker.generateAnnotation(env, attr, annoType); } } return null; }