@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round) { if (!round.processingOver() && !round.errorRaised()) { processTemplates(round.getElementsAnnotatedWith(Generator.Template.class)); } return true; }
public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { return false; } if (roundEnv.processingOver()) { writeServices(); outputFilesByProcessor.clear(); originatingElementsByProcessor.clear(); return true; } else { return handleProcess(annotations, roundEnv); } }
@Override public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round) { try { StaticEnvironment.init(annotations, round, processingEnv); if (!round.processingOver() && !round.errorRaised()) { process(); } StaticEnvironment.shutdown(); } catch (Exception ex) { processingEnv.getMessager() .printMessage(Diagnostic.Kind.ERROR, getClass().getName() + " threw " + Throwables.getStackTraceAsString(ex)); } return false; } }
Document doc = generatedLayerByProcessor.remove(filer); Collection<Element> originatingElementsL = originatingElementsByProcessor.remove(filer); if (doc != null && !roundEnv.errorRaised()) { Element[] originatingElementsA = new Element[0]; if (originatingElementsL != null) {
@Override public boolean errorRaised() { return this.delegate.errorRaised(); }
@Override public boolean errorRaised() { return this.delegate.errorRaised(); }
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round) { if (!round.processingOver() && !round.errorRaised()) { processTemplates(round.getElementsAnnotatedWith(Generator.Template.class)); } return true; }
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.errorRaised() && !roundEnv.processingOver()) { processRound(annotations, roundEnv); } return false; }
public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { return false; } if (roundEnv.processingOver()) { writeServices(); outputFilesByProcessor.clear(); originatingElementsByProcessor.clear(); return true; } else { return handleProcess(annotations, roundEnv); } }
private Collection<? extends Element> getAnnotatedElementsIfValid(RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { return null; } Collection<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(GenerateDiffFunction.class); if (annotatedElements.size() == 0) { return null; } List<Element> notClassElements = annotatedElements.stream() .filter(element -> !element.getKind().isInterface() && !element.getKind().isClass()) .collect(Collectors.toList()); if (notClassElements.size() > 0) { notClassElements.forEach(element -> processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Only interfaces or classes are supported for @" + GenerateDiffFunction.class.getSimpleName(), element)); return null; } return annotatedElements; }
public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { return false; } if (roundEnv.processingOver()) { writeServices(); outputFilesByProcessor.clear(); originatingElementsByProcessor.clear(); return true; } else { return handleProcess(annotations, roundEnv); } }
public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { return false; } if (roundEnv.processingOver()) { writeServices(); outputFilesByProcessor.clear(); originatingElementsByProcessor.clear(); return true; } else { return handleProcess(annotations, roundEnv); } }
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised() || roundEnv.processingOver()) { return false; } for (Element e : roundEnv.getElementsAnnotatedWith(Schema2Beans.class)) { handle(e, e.getAnnotation(Schema2Beans.class)); } for (Element e : roundEnv.getElementsAnnotatedWith(Multiple.class)) { for (Schema2Beans s2b : e.getAnnotation(Multiple.class).value()) { handle(e, s2b); } } return true; }
@Override protected boolean processWithExceptions(Set<? extends TypeElement> set, RoundEnvironment roundEnv) throws Exception { if (roundEnv.processingOver()) { return processLastRound(set, roundEnv); } //If prior processing threw an error exit if (roundEnv.errorRaised()) { return false; } //Initialize the generator generator = SVGGeneratorFactory.newGenerator(); // Process SVG Shape View Factories for the annotated types. final Elements elementUtils = processingEnv.getElementUtils(); for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ANNOTATION_SVGSHAPE_VIEW_FACTORY))) { processSvgShapeViewFactory(set, e, roundEnv); } return true; }
@Override public boolean process( final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) { if (roundEnv.errorRaised() || roundEnv.processingOver()) { return true; } for (final TypeElement ate : annotations) { assert ate.asType().toString().equals(Obfuscate.class.getName()); for (final Element e : roundEnv.getElementsAnnotatedWith(ate)) { final VariableElement ve = (VariableElement) e; final TypeElement cte = (TypeElement) ve.getEnclosingElement(); try { final String csv = (String) ve.getConstantValue(); if (keepField(ve)) { warn("Obfuscation of protected or public or non-static field is insecure because it can't get removed from the byte code.", ve); } debug(ObfuscatedString.obfuscate(csv), ve); } catch (RuntimeException ex) { error("Annotated field does not have a constant string value.", ve); } } } return true; }
public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { debug("roundEnv.errorRaised(true)"); return false; } if (roundEnv.processingOver()) { writeFiles(); debug("writeFiles()"); return true; } else { debug("handleProcess()"); return handleProcess(annotations, roundEnv); } }
public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { debug("roundEnv.errorRaised(true)"); return false; } if (roundEnv.processingOver()) { writeFiles(); debug("writeFiles()"); return true; } else { debug("handleProcess()"); return handleProcess(annotations, roundEnv); } }
@Test @SuppressWarnings("unchecked") public void testMultipleSVGViewFactories() throws Exception { types.add(makeTypeElement("Factory1")); types.add(makeTypeElement("Factory2")); when(roundEnvironment.errorRaised()).thenReturn(false); when(roundEnvironment.getElementsAnnotatedWith(SVGViewFactoryAnnotation)).thenReturn(types); when(elements.getTypeElement(SVGShapeProcessor.ANNOTATION_SVGSHAPE_VIEW_FACTORY)).thenReturn(SVGViewFactoryAnnotation); //First round processing gathering requirements when(roundEnvironment.processingOver()).thenReturn(false); processor.processWithExceptions(elementTypes, roundEnvironment); //Last round processing writing generated files when(roundEnvironment.processingOver()).thenReturn(true); processor.processWithExceptions(elementTypes, roundEnvironment); verify(filer, times(2)).createSourceFile(generatedSourceFileNames.capture()); assertContains(this.getClass().getPackage().getName() + ".Factory1Impl"); assertContains(this.getClass().getPackage().getName() + ".Factory2Impl"); }
@Override public boolean errorRaised() { checkDelegateNotNull(); return getDelegate().errorRaised(); }
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.errorRaised()) { return false; } try { utils.incrementRoundNumber(); processSafe(annotations, roundEnv); } catch (UnableToProcessException ignore) { } catch (Exception e) { logger.error().throwable(e).log(UNRESOLVABLE_EXCEPTION); } return false; }