Java 类javax.annotation.processing.RoundEnvironment 实例源码

项目:annotation-processor-toolkit    文件:AbstractUnitTestAnnotationProcessorClass.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {

    try {
        ToolingProvider.setTooling(processingEnv);

        Set<? extends Element> set = roundEnv.getElementsAnnotatedWith(TestAnnotation.class);

        if (set.size() == 1) {
            testCase((TypeElement) set.iterator().next());
        }

    } finally {
        ToolingProvider.clearTooling();
    }
    return false;
}
项目:convalida    文件:ConvalidaProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> typeElements, RoundEnvironment env) {
    List<ValidationClass> validationClasses = findAndParseValidations(env);

    // Generate validation classes source code
    for (ValidationClass validationClass : validationClasses) {
        try {
            JavaFile javaFile = JavaFiler.cookJava(validationClass);
            javaFile.writeTo(this.filer);
        } catch (IOException e) {
            error(validationClass.getTypeElement(), "Unable to write validation for type %s: %s", validationClass.getTypeElement(), e.getMessage());
        }
    }

    return false;
}
项目:incap    文件:InputTypeFinderAnnotationTestProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {

  if (roundEnv.processingOver()) {
    return false;
  }

  Set<? extends Element> elementsAnnotatedWith =
      roundEnv.getElementsAnnotatedWith(Annotation1.class);

  if (elementsAnnotatedWith.size() != 1) {
    throw new IllegalStateException(
        "There must be exactly one element to process. Actual=" + elementsAnnotatedWith.size());
  }

  for (Element element : elementsAnnotatedWith) {
    inputTypeForElement = inputTypeFinder.findInputTypeForElement(element);
  }

  return false;
}
项目:EM    文件:ActivatorAnnotationProcessor.java   
private void processRound(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    loop: for (TypeElement annotation : annotations) {
        for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) {
            if (element.getAnnotation(Activator.class).extension()) {
                extensionActivator = element.asType().toString();
            } else {
                activator = element.asType().toString();
            }
            if (activator != null && extensionActivator != null) {
                break loop;
            }
        }
    }
    try {
        generateFile();
    } catch (IOException e) {
        messager.printMessage(Kind.ERROR, "IOException while generating file with contracts! " + e.getMessage());
        e.printStackTrace();
    }
}
项目:cuckoo    文件:DelegationProcessor.java   
private Map<ExecutableElement, String> getMethodToFieldNameMap(RoundEnvironment roundEnvironment) {
    final Map<ExecutableElement, String> methodToFieldNameMap = new HashMap<>();

    for (Element byElement : roundEnvironment.getElementsAnnotatedWith(By.class)) {
        if (byElement.getKind() != ElementKind.FIELD) {
            continue;
        }
        VariableElement byField = (VariableElement) byElement;
        for (Element element : typeUtils.asElement(byField.asType()).getEnclosedElements()) {
            if (element.getKind() != ElementKind.METHOD) {
                continue;
            }
            ExecutableElement method = (ExecutableElement) element;
            methodToFieldNameMap.put(method, byField.getSimpleName().toString());
        }
    }

    return methodToFieldNameMap;
}
项目:incap    文件:M1_OneToOneAP.java   
@Override
public boolean incrementalProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  for (TypeElement annotation : annotations) {
    System.out.println("Processing annotation:" + annotation);
  }

  if (isProcessingDone) {
    return false;
  }

  // generates a class with a constant that contains the name of all classes containing an annotation.
  Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(Annotation1.class);
  Map<String, Set<? extends Element>> mapGeneratedFileNameToOriginatingElements = processElements(annotatedElements);
  generateFiles(incrementalProcessingEnvironment.getFiler(), mapGeneratedFileNameToOriginatingElements);
  isProcessingDone = true;
  return false;
}
项目:GitHub    文件:ButterKnifeProcessor.java   
@Override public boolean process(Set<? extends TypeElement> elements, RoundEnvironment env) {
  Map<TypeElement, BindingSet> bindingMap = findAndParseTargets(env);

  for (Map.Entry<TypeElement, BindingSet> entry : bindingMap.entrySet()) {
    TypeElement typeElement = entry.getKey();
    BindingSet binding = entry.getValue();

    JavaFile javaFile = binding.brewJava(sdk);
    try {
      javaFile.writeTo(filer);
    } catch (IOException e) {
      error(typeElement, "Unable to write binding for type %s: %s", typeElement, e.getMessage());
    }
  }

  return false;
}
项目:openjdk-jdk10    文件:T7159016.java   
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (roundEnv.processingOver() || written++ > 0) {
        return false;
    }
    messager.printMessage(Diagnostic.Kind.NOTE, "writing Generated.java");
    try {
        Writer w = processingEnv.getFiler().createSourceFile("p.Generated").openWriter();
        try {
            w.write("package p; public class Generated { public static void m() { } }");
        } finally {
            w.close();
        }
    } catch (IOException x) {
        messager.printMessage(Diagnostic.Kind.ERROR, x.toString());
    }
    return true;
}
项目:sql-first-mapper    文件:SqlFirstAnnotationProcessor.java   
/**
 * Prepare global config
 *
 * @param roundEnv annotation processor environment
 */
private Element prepareGlobalConfig(RoundEnvironment roundEnv) {
    Element sqlFirstApcConfigElement = null;

    //TODO read with filer for the case of partial compilation
    Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(SqlFirstApcConfig.class);
    for (Element element : annotatedElements) {
        if (sqlFirstApcConfigElement == null) {
            sqlFirstApcConfigElement = element;
        } else {
            processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "SqlFirstApcConfig annotation must be declared only once ", element);
        }
    }
    return sqlFirstApcConfigElement;

}
项目:GitHub    文件:MvpCompiler.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (annotations.isEmpty()) {
        return false;
    }

    try {
        return throwableProcess(roundEnv);
    } catch (RuntimeException e) {
        getMessager().printMessage(Diagnostic.Kind.OTHER, "Moxy compilation failed. Could you copy stack trace above and write us (or make issue on Githhub)?");
        e.printStackTrace();
        getMessager().printMessage(Diagnostic.Kind.ERROR, "Moxy compilation failed; see the compiler error output for details (" + e + ")");
    }

    return true;
}
项目:openjdk-jdk10    文件:AnnotationProcessing.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (processingEnv.getElementUtils().getModuleElement("m1x") == null) {
        throw new AssertionError("No m1x module found.");
    }

    Messager messager = processingEnv.getMessager();

    for (TypeElement clazz : ElementFilter.typesIn(roundEnv.getRootElements())) {
        for (VariableElement field : ElementFilter.fieldsIn(clazz.getEnclosedElements())) {
            messager.printMessage(Kind.NOTE, "field: " + field.getSimpleName());
        }
    }

    return false;
}
项目:openjdk-jdk10    文件:Processor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (round++ == 0) {
        try (Writer out = processingEnv.getFiler()
                                             .createSourceFile("Anno.java")
                                             .openWriter()) {
            String target = processingEnv.getOptions().get("target");
            String code = "import java.lang.annotation.ElementType;\n" +
                          "import java.lang.annotation.Target;\n" +
                          "@Target(ElementType." + target + ")\n" +
                          "@interface Anno { public String value(); }\n";
            out.write(code);
        } catch (IOException exc) {
            throw new IllegalStateException(exc);
        }
    }
    return true;
}
项目:AutoViewModelFactory    文件:AutoViewModelFactoryProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {

    try {
        if (!findAnnotatedViewModels(roundEnvironment)) {
            return true;
        }

        for (TypeElement viewModelElement : viewModels) {
            generateViewModelFactory(viewModelElement);
        }

    } catch (IOException e) {
        error("An error has occurred.");
        e.printStackTrace();
    }

    return true;
}
项目:RIBs    文件:RibProcessor.java   
@Override
public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {

  if (roundEnv.processingOver()) {
    return false;
  }

  for (ProcessorPipeline processorPipeline : processorPipelines) {
    try {
      processorPipeline.process(annotations, roundEnv);
    } catch (Throwable e) {
      errorReporter.reportError(
          String.format(
              Locale.getDefault(),
              "Fatal error running %s processor: %s",
              processorPipeline.getAnnotationType().getSimpleName(),
              e.getMessage()));
    }
  }
  return false;
}
项目:javaide    文件:CreateSymbols.java   
public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
    try {
        if (renv.processingOver())
            createSymbols();
    } catch (IOException e) {
        processingEnv.getMessager()
                .printMessage(Diagnostic.Kind.ERROR, e.getLocalizedMessage());
    } catch (Throwable t) {
        Throwable cause = t.getCause();
        if (cause == null)
            cause = t;
        processingEnv.getMessager()
                .printMessage(Diagnostic.Kind.ERROR, cause.getLocalizedMessage());
    }
    return true;
}
项目:openjdk-jdk10    文件:VerifierAnnotationProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (!roundEnv.processingOver()) {
        PluginGenerator generator = new PluginGenerator();
        for (AbstractVerifier verifier : getVerifiers()) {
            Class<? extends Annotation> annotationClass = verifier.getAnnotationClass();
            for (Element e : roundEnv.getElementsAnnotatedWith(annotationClass)) {
                AnnotationMirror annotationMirror = findAnnotationMirror(processingEnv, e.getAnnotationMirrors(), annotationClass);
                if (annotationMirror == null) {
                    assert false : "Annotation mirror always expected.";
                    continue;
                }
                verifier.verify(e, annotationMirror, generator);
            }
        }

        generator.generateAll(processingEnv);
    }
    return false;
}
项目:GitHub    文件:RealmProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    round++;

    if (round == 0) {
        RealmVersionChecker.getInstance(processingEnv).executeRealmVersionUpdate();
    }

    if (roundEnv.errorRaised()) { return true; }

    if (!hasProcessedModules) {
        Utils.initialize(processingEnv);

        if (!processAnnotations(roundEnv)) { return true; }

        hasProcessedModules = true;
        if (!processModules(roundEnv)) { return true; }
    }

    if (roundEnv.processingOver()) {
        if (!validateBacklinks()) { return true; }
    }

    return CONSUME_ANNOTATIONS;
}
项目:DDComponentForAndroid    文件:AutowiredProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
    if (CollectionUtils.isNotEmpty(set)) {
        try {
            logger.info(">>> Found autowired field, start... <<<");
            categories(roundEnvironment.getElementsAnnotatedWith(Autowired.class));
            generateHelper();

        } catch (Exception e) {
            logger.error(e);
        }
        return true;
    }

    return false;
}
项目:incubator-netbeans    文件:VCSRegistrationProcessor.java   
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
    for (Element e : roundEnv.getElementsAnnotatedWith(VersioningSystem.Registration.class)) {
        Registration a = e.getAnnotation(VersioningSystem.Registration.class);
        if (a == null) {
            continue;
        }
        File f = layer(e).instanceFile("Services/VersioningSystem", null, a, null); // NOI18N
        f.methodvalue("instanceCreate", DelegatingVCS.class.getName(), "create");                // NOI18N
        f.stringvalue("instanceOf", org.netbeans.modules.versioning.core.spi.VersioningSystem.class.getName()); // NOI18N
        String[] folderNames = a.metadataFolderNames();
        for (int i = 0; i < folderNames.length; i++) {
            f.stringvalue("metadataFolderName" + i, folderNames[i]);        // NOI18N
        }
        f.instanceAttribute("delegate", VersioningSystem.class);            // NOI18N
        f.bundlevalue("displayName", a.displayName());                      // NOI18N
        f.bundlevalue("menuLabel", a.menuLabel());                          // NOI18N
        f.stringvalue("actionsCategory", a.actionsCategory());              // NOI18N
        f.write();
    }
    return true;
}
项目:incubator-netbeans    文件:PatchedPublicProcessor.java   
private void flush(RoundEnvironment roundEnv) {
    if (!originatingElements.isEmpty()) {
        try (OutputStream os = processingEnv.getFiler().createResource(
                StandardLocation.CLASS_OUTPUT,
                "", "META-INF/.bytecodePatched",
                originatingElements.toArray(new Element[originatingElements.size()])).openOutputStream()) {
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
            for (Map.Entry<String, String> exEntry : superclasses.entrySet()) {
                String api = exEntry.getKey();
                String sup = exEntry.getValue();

                bw.append("extend.").append(api).append("=").append(sup);
                bw.newLine();
            }
            bw.flush();
        } catch (IOException x) {
            processingEnv.getMessager().printMessage(Kind.ERROR, x.getMessage());
        }
    }
}
项目:RxPay    文件:EntityHandler.java   
public Map<String, ClassEntity> handlerElement(RoundEnvironment env, BaseProcessor processor) {
    this.env = env;
    for (Class<? extends Annotation> support : processor.getSupportedAnnotations()) {
        for (Element element : env.getElementsAnnotatedWith(support)) {
            if (element.getKind() == ElementKind.FIELD){
                handlerField((VariableElement) element);
            }
            if (element.getKind() == ElementKind.METHOD){
                handlerMethod((ExecutableElement) element);
            }
            if (element.getKind() == ElementKind.CLASS) {
                handlerClass((TypeElement) element);
            }
        }
    }
    return classEntityMap;
}
项目:incubator-netbeans    文件:VCSRegistrationProcessor.java   
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
    for (Element e : roundEnv.getElementsAnnotatedWith(VersioningSystem.Registration.class)) {
        Registration r = e.getAnnotation(VersioningSystem.Registration.class);
        if(r == null) {
            continue;
        }
        String s = processingEnv.getElementUtils().getBinaryName((TypeElement)e).toString();

        File f = layer(e).instanceFile("Services/VersioningSystem", null, r, null); // NOI18N
        f.methodvalue("instanceCreate", DelegatingVCS.class.getName(), "create");    // NOI18N
        f.stringvalue("instanceOf", VersioningSystem.class.getName()); 
        String[] folderNames = r.metadataFolderNames();
        for (int i = 0; i < folderNames.length; i++) {
            f.stringvalue("metadataFolderName" + i, folderNames[i]);        // NOI18N
        }
        f.instanceAttribute("delegate", VersioningSystem.class);            // NOI18N
        f.bundlevalue("displayName", r.displayName());                      // NOI18N
        f.bundlevalue("menuLabel", r.menuLabel());                          // NOI18N
        f.stringvalue("actionsCategory", r.actionsCategory());              // NOI18N    
        f.boolvalue("isLocalHistory", s.equals("org.netbeans.modules.localhistory.LocalHistoryVCS")); // NOI18N    
        f.write();
    }
    return true;
}
项目:RxRetroJsoup    文件:RetroJsoupProcessor.java   
protected void processAnnotations(RoundEnvironment env) {
    for (Element element : env.getElementsAnnotatedWith(Select.class)) {
        if (isChildOfInterface(element)) {
            processSelect(element.getEnclosingElement());
        }
    }

    final Set<Element> jsoupAnnotatedField = new HashSet<>();
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupHref.class));
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupText.class));
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupSrc.class));
    jsoupAnnotatedField.addAll(env.getElementsAnnotatedWith(JsoupAttr.class));

    final Set<Element> jsoupModels = new HashSet<>();
    for (Element field : jsoupAnnotatedField) {
        jsoupModels.add(field.getEnclosingElement());
    }

    processJsoupModels(jsoupModels);
}
项目:incubator-netbeans    文件:DebuggerProcessor.java   
@Override
protected boolean handleProcess(
    Set<? extends TypeElement> annotations,
    RoundEnvironment env
) throws LayerGenerationException {
    if (env.processingOver()) {
        return false;
    }

    int cnt = 0;
    for (Element e : env.getElementsAnnotatedWith(VariablesFilter.Registration.class)) {
        VariablesFilter.Registration reg = e.getAnnotation(VariablesFilter.Registration.class);

        final String path = reg.path();
        handleProviderRegistration(e, VariablesFilter.class, path);
        cnt++;
    }
    return cnt == annotations.size();
}
项目:openjdk-jdk10    文件:GenerateSuperInterfaceProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    for (Element el : roundEnv.getElementsAnnotatedWith(Generate.class)) {
        Generate g = el.getAnnotation(Generate.class);

        Assert.checkNonNull(g);

        try (OutputStream out =
                processingEnv.getFiler().createSourceFile(g.fileName()).openOutputStream()) {
            out.write(g.content().getBytes());
        } catch (IOException ex) {
            throw new IllegalStateException(ex);
        }
    }

    return false;
}
项目:sql-first-mapper    文件:SqlFirstAnnotationProcessor.java   
/**
 * Prepare Dao interfaces from {@link SqlSourceFile} annotation
 *
 * @param daoDescList dao description
 * @param roundEnv annotation processor environment
 */
private void prepareDaoClassImplementMap(List<DaoDesc> daoDescList, RoundEnvironment roundEnv) {
    Map<String, DaoDesc> daoDescMap = daoDescList.stream().collect(Collectors.toMap(DaoDesc::getSourceClassName, x -> x));

    Elements elementUtils = processingEnv.getElementUtils();

    Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(SqlSourceFile.class);
    for (Element element : annotatedElements) {
        SqlSourceFile ann = element.getAnnotation(SqlSourceFile.class);
        String key = elementUtils.getPackageOf(element).getQualifiedName().toString() + "." + element.getSimpleName().toString();
        DaoDesc daoDesc = daoDescMap.get(key);
        if (daoDesc == null){
            continue;
        }
        if (ann.implement()) {
            daoDesc.setImplementClassName(element.asType().toString());
        }
        daoDesc.setDaoType(ann.value());
        daoDesc.setTargetClassName(ann.targetClassName());
        daoDesc.setBaseDaoClassName(ann.baseDaoClassName());
    }
}
项目:incubator-netbeans    文件:CoreManagerProcessor.java   
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {

    for (Element e : roundEnv.getElementsAnnotatedWith(CoreManager.Registration.class)) {
        CoreManager.Registration registration = e.getAnnotation(CoreManager.Registration.class);            
        if(registration == null) {
            continue;
        }
        LayerBuilder.File f = layer(e).instanceFile("Services", null);
        f.stringvalue("instanceOf", CoreManager.class.getName());
        f.bundlevalue("displayName", registration.projectType().concat("_").concat(registration.testingFramework()));
        f.write();
    }

    return true;
}
项目:prefpin    文件:PrefPinProcessor.java   
@Override public boolean process(Set<? extends TypeElement> annotations,
    RoundEnvironment roundEnvironment) {

  Map<TypeElement, Set<Element>> bindingMap = new LinkedHashMap<>();
  parsePreferenceBinding(roundEnvironment, bindingMap, BindPref.class);
  parsePreferenceBinding(roundEnvironment, bindingMap, OnPrefClick.class);
  parsePreferenceBinding(roundEnvironment, bindingMap, OnPrefChange.class);

  if (!bindingMap.isEmpty()) {
    for (Map.Entry<TypeElement, Set<Element>> entry : bindingMap.entrySet()) {
      String targetClassName = entry.getKey().getQualifiedName().toString();

      try {
        writeBinding(targetClassName, entry.getValue());
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }

  return true;
}
项目:incubator-netbeans    文件:BugtrackingRegistrationProcessor.java   
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
    for (Element e : roundEnv.getElementsAnnotatedWith(BugtrackingConnector.Registration.class)) {
        Registration r = e.getAnnotation(BugtrackingConnector.Registration.class);
        if (r == null) {
            continue;
        }
        File f = layer(e).instanceFile("Services/Bugtracking", null, r, null);                   // NOI18N
        f.methodvalue("instanceCreate", DelegatingConnector.class.getName(), "create");          // NOI18N
        f.stringvalue("instanceOf", BugtrackingConnector.class.getName());                       // NOI18N
        f.instanceAttribute("delegate", BugtrackingConnector.class);                             // NOI18N
        f.bundlevalue("displayName", r.displayName());                                           // NOI18N
        f.bundlevalue("tooltip", r.tooltip());                                                   // NOI18N
        f.stringvalue("id", r.id());                                                             // NOI18N
        f.boolvalue("providesRepositoryManagement", r.providesRepositoryManagement());                                             // NOI18N
        if (!r.iconPath().isEmpty()) {
            f.bundlevalue("iconPath", r.iconPath());                                             // NOI18N
        }
        f.write();
    }
    return true;
}
项目:incap    文件:NUnrelatedANDToOneAP.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  for (TypeElement annotation : annotations) {
    System.out.println("Processing annotation:" + annotation);
  }

  if (isProcessingDone) {
    return false;
  }

  // generates a class with a constant that contains the name of all classes containing an annotation.
  Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(Annotation1.class);
  Map<String, Set<? extends Element>> mapGeneratedFileNameToOriginatingElements = processElements(annotatedElements);
  generateFiles(filer, mapGeneratedFileNameToOriginatingElements);
  isProcessingDone = true;
  return false;
}
项目:limitjson    文件:JSONProcessor.java   
private void processLimitJSON(RoundEnvironment roundEnv) {
        for (Element element : roundEnv.getElementsAnnotatedWith(LIMITJSON.class)) {
            LJSONTypeElement ljsonElement = LJSONTypeElement.create(elements, element);
            processorHelper.setLimitJSONTypeElements(ljsonElement);
            processorHelper.i("---------------------" + ljsonElement.toString());
//
            TypeElement typeElement = (TypeElement) element;
            Element a = typeElement.getEnclosingElement();
            processorHelper.i("LJSON ++" + a + " " + element.getKind().name());
            List<? extends Element> param = typeElement.getEnclosedElements();
            for (Element p : param) {
                if (p instanceof VariableElement) {
                    processorHelper.i("LJSON ........" + p.getSimpleName() + " " + p.asType().toString());
                }
            }

        }
    }
项目:easy-plugins    文件:CompletePluginGenerator.java   
public static void buildServiceFiles(Element annotationElement,
                                     RoundEnvironment roundEnv,
                                     ProcessingEnvironment procEnv,
                                     ProcessorOutputCollection output) {
    buildFiles(
            PluginAnnotation.createUserMarker(annotationElement, procEnv),
            procEnv,
            roundEnv,
            output,
            false);


}
项目:Avatar    文件:TestAvatarRuleWithNoCode.java   
@Test
public void testGetRoundEnvironments() {
    final Collection<RoundEnvironment> roundEnvironments1 = rule1.getRoundEnvironments();
    final Collection<RoundEnvironment> roundEnvironments2 = rule2.getRoundEnvironments();

    assertThat(roundEnvironments1, is(notNullValue()));
    assertThat(roundEnvironments2, is(notNullValue()));
}
项目:EM    文件:ContractsAnnotationProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (!roundEnv.errorRaised() && !roundEnv.processingOver()) {
        processRound(annotations, roundEnv);
    }
    return false;
}
项目:Surgeon    文件:SurgeonProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment env) {
    List<JavaFile> files = findAndParseTargets(env);
    for (JavaFile javaFile : files) {
        try {
            javaFile.writeTo(filer);
        } catch (IOException e) {
            error("Unable to write same name %s: %s", javaFile.packageName, e.getMessage());
        }
    }
    return false;
}
项目:EM    文件:FragmentAnnotationProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (!roundEnv.errorRaised() && !roundEnv.processingOver()) {
        processRound(annotations, roundEnv);
    }
    return false;
}
项目:drift    文件:JavadocProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round)
{
    for (TypeElement annotation : annotations) {
        for (Element element : round.getElementsAnnotatedWith(annotation)) {
            if (element instanceof TypeElement) {
                log(NOTE, "Extracting Javadoc metadata for " + element);
                extract((TypeElement) element);
            }
        }
    }
    return false;
}
项目:Router    文件:InterceptorProcessor.java   
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
    Set<? extends Element> elements = roundEnvironment.getElementsAnnotatedWith(Interceptor.class);
    if (elements == null || elements.isEmpty()) {
        return true;
    }
    mLogger.info(String.format(">>> %s: InterceptorProcessor begin... <<<", mModuleName));
    // 合法的TypeElement集合
    Set<TypeElement> typeElements = new HashSet<>();
    for (Element element : elements) {
        if (validateElement(element)) {
            typeElements.add((TypeElement) element);
        } else {
            mLogger.error(element, String.format("The annotated element is not a implementation class of %s",
                    INTERCEPTOR_INTERFACE));
        }
    }

    if (mModuleName != null) {
        String validModuleName = mModuleName.replace(".", "_").replace("-", "_");
        generateInterceptors(validModuleName, typeElements);
    } else {
        throw new RuntimeException(String.format("No option `%s` passed to Interceptor annotation processor.", OPTION_MODULE_NAME));
    }
    mLogger.info(String.format(">>> %s: InterceptorProcessor end. <<<", mModuleName));
    return true;
}
项目:boohee_v5.6    文件:ButterKnifeProcessor.java   
private void findAndParseListener(RoundEnvironment env, Class<? extends Annotation> annotationClass, Map<TypeElement, ViewInjector> targetClassMap, Set<String> erasedTargetNames) {
    for (Element element : env.getElementsAnnotatedWith(annotationClass)) {
        try {
            parseListenerAnnotation(annotationClass, element, targetClassMap, erasedTargetNames);
        } catch (Exception e) {
            e.printStackTrace(new PrintWriter(new StringWriter()));
            error(element, "Unable to generate view injector for @%s.\n\n%s", annotationClass.getSimpleName(), stackTrace.toString());
        }
    }
}
项目:smartkey    文件:Generator.java   
public void handle(RoundEnvironment env) {
    clzs.clear();
    if(!prepareEnv(env)) {
        return;
    }
    genCodes();
}