/** * Create a new {@code AnnotationDetector}, reporting the detected annotations to the specified * {@code Reporter}. */ public AnnotationDetector(final Reporter reporter) { final Class<? extends Annotation>[] a = reporter.annotations(); annotations = new HashMap<String, Class<? extends Annotation>>(a.length); // map "raw" type names to Class object for (int i = 0; i < a.length; ++i) { annotations.put("L" + a[i].getName().replace('.', '/') + ";", a[i]); } if (reporter instanceof TypeReporter) { typeReporter = (TypeReporter) reporter; } if (reporter instanceof FieldReporter) { fieldReporter = (FieldReporter) reporter; } if (reporter instanceof MethodReporter) { methodReporter = (MethodReporter) reporter; } if (typeReporter == null && fieldReporter == null && methodReporter == null) { throw new AssertionError("No reporter defined"); } }