private static void processElement(AnnotationProcessor<?> generator, Element e, boolean callback) { try { generator.process(e, callback); } catch (Throwable e1) { handleThrowable(generator, e1, e); } }
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { processImpl(roundEnv); } return false; }
@Override public Set<String> getSupportedAnnotationTypes() { Set<String> annotations = new HashSet<>(); addAnnotations(annotations, Arrays.asList(Fallback.class, TypeSystemReference.class, Specialization.class, Executed.class, NodeChild.class, NodeChildren.class)); addAnnotations(annotations, Arrays.asList(TypeSystem.class)); return annotations; }
private void processImpl(RoundEnvironment env) { // TODO run verifications that other annotations are not processed out of scope of the // operation or type lattice. try { ProcessorContext.setThreadLocalInstance(new ProcessorContext(processingEnv, this)); for (AnnotationProcessor<?> generator : getGenerators()) { AbstractParser<?> parser = generator.getParser(); if (parser.getAnnotationType() != null) { for (Element e : env.getElementsAnnotatedWith(parser.getAnnotationType())) { processElement(generator, e, false); } } for (Class<? extends Annotation> annotationType : parser.getTypeDelegatedAnnotationTypes()) { for (Element e : env.getElementsAnnotatedWith(annotationType)) { TypeElement processedType; if (parser.isDelegateToRootDeclaredType()) { processedType = ElementUtils.findRootEnclosingType(e); } else { processedType = ElementUtils.findNearestEnclosingType(e); } processElement(generator, processedType, false); } } } } finally { ProcessorContext.setThreadLocalInstance(null); } }
@Override public void callback(TypeElement template) { for (AnnotationProcessor<?> generator : generators) { Class<? extends Annotation> annotationType = generator.getParser().getAnnotationType(); if (annotationType != null) { Annotation annotation = template.getAnnotation(annotationType); if (annotation != null) { processElement(generator, template, true); } } } }
private void processImpl(RoundEnvironment env) { // TODO run verifications that other annotations are not processed out of scope of the // operation or typelattice. try { ProcessorContext.setThreadLocalInstance(new ProcessorContext(processingEnv, this)); for (AnnotationProcessor<?> generator : getGenerators()) { AbstractParser<?> parser = generator.getParser(); if (parser.getAnnotationType() != null) { for (Element e : env.getElementsAnnotatedWith(parser.getAnnotationType())) { processElement(generator, e, false); } } for (Class<? extends Annotation> annotationType : parser.getTypeDelegatedAnnotationTypes()) { for (Element e : env.getElementsAnnotatedWith(annotationType)) { TypeElement processedType; if (parser.isDelegateToRootDeclaredType()) { processedType = ElementUtils.findRootEnclosingType(e); } else { processedType = ElementUtils.findNearestEnclosingType(e); } processElement(generator, processedType, false); } } } } finally { ProcessorContext.setThreadLocalInstance(null); } }
@Override public void callback(TypeElement template) { for (AnnotationProcessor<?> generator : generators) { Class<? extends Annotation> annotationType = generator.getParser().getAnnotationType(); if (annotationType != null) { Annotation annotation = template.getAnnotation(annotationType); if (annotation != null) { processElement(generator, template, true); } } } }
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { processImpl(roundEnv); } return false; }
private static void processElement(AnnotationProcessor<?> generator, Element e, boolean callback) { try { generator.process(e, callback); } catch (Throwable e1) { handleThrowable(generator, e1, e); } }