public List<Class<? extends Annotation>> getAllAnnotationTypes() { List<Class<? extends Annotation>> list = new ArrayList<>(); if (getAnnotationType() != null) { list.add(getAnnotationType()); } list.addAll(getTypeDelegatedAnnotationTypes()); return list; }
public List<Class<? extends Annotation>> getAllAnnotationTypes() { List<Class<? extends Annotation>> list = new ArrayList<>(); if (getAnnotationType() != null) { list.add(getAnnotationType()); } list.addAll(getTypeDelegatedAnnotationTypes()); return list; }
@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 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); } } } }
public final M parse(Element element) { M model = null; try { AnnotationMirror mirror = null; if (getAnnotationType() != null) { mirror = ElementUtils.findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), getAnnotationType()); } if (!context.getTruffleTypes().verify(context, element, mirror)) { return null; } model = parse(element, mirror); if (model == null) { return null; } redirectMessages(new HashSet<MessageContainer>(), model, model); model.emitMessages(context, log); return filterErrorElements(model); } catch (CompileErrorException e) { log.message(Kind.WARNING, element, null, null, "The truffle processor could not parse class due to error: %s", e.getMessage()); return null; } }
public final M parse(Element element) { M model = null; try { AnnotationMirror mirror = null; if (getAnnotationType() != null) { mirror = ElementUtils.findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), getAnnotationType()); } if (!context.getTruffleTypes().verify(context, element, mirror)) { return null; } model = parse(element, mirror); if (model == null) { return null; } redirectMessages(new HashSet<MessageContainer>(), model, model); model.emitMessages(context, log); if (model instanceof NodeData) { return model; } else { return filterErrorElements(model); } } catch (CompileErrorException e) { log.message(Kind.WARNING, element, null, null, "The truffle processor could not parse class due to error: %s", e.getMessage()); return null; } }
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); } }
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); } }