@Override
  public void finished(TaskEvent taskEvent) {
    JCCompilationUnit jcc = (JCCompilationUnit) taskEvent.getCompilationUnit();

    if (taskEvent.getKind().equals(TaskEvent.Kind.ENTER)) {
      persistentify(jcc);
      //			out.println("########## FINISH ENTER\n\n\n"+jcc.toString());
    }
  }
    @Override
    public void finished(TaskEvent e) {
      if (e.getKind() != TaskEvent.Kind.ANALYZE) return;

      if (!elements.remove(e.getTypeElement().getQualifiedName())) return;

      if (e.getTypeElement().getSimpleName().contentEquals("MyClass")) {
        Element owner = e.getTypeElement().getEnclosingElement();
        if (owner.getKind() != ElementKind.PACKAGE)
          throw new RuntimeException("class owner should be a package: " + owner);
        if (owner.getAnnotationMirrors().size() != 1)
          throw new RuntimeException("the owner package should have one annotation: " + owner);
      }
    }
  /*
   * 4 compilation phases
   *
   * PARSE
   * For events related to the parsing of a file.
   * ENTER
   * For events relating to elements being entered.
   *
   * ##################################################################
   * !!! Begins after ENTER phase, repeats ENTER phase when it ends !!!
   * ##################### ############################################
   * ANNOTATION_PROCESSING
   * For events relating to overall annotation processing.
   * ANNOTATION_PROCESSING_ROUND
   * For events relating to an individual annotation processing round.
   *
   * ANALYZE
   * For events relating to elements being analyzed for errors.
   * ------> DESUGAR HAPPENS BETWEEN THESE, SO AT GENERATE.START
   * GENERATE
   * For events relating to class files being generated.
   * ------> SOURCE CODE IS GENERATED AND DISAPEARED NOW
   *
   * This ones for some reason are not beeing called...
   *
   */
  @Override
  public void started(TaskEvent taskEvent) {
    JCCompilationUnit jcc = (JCCompilationUnit) taskEvent.getCompilationUnit();

    //		if (taskEvent.getKind().equals(TaskEvent.Kind.GENERATE)) {
    //			out.println("########## START ENTER\n\n\n"+jcc.toString());
    //			savingModdedSources(taskEvent);
    //		}
  }
 @Override
 @DefinedBy(Api.COMPILER_TREE)
 public void finished(TaskEvent e) {
   if (e.getKind() == TaskEvent.Kind.COMPILATION) {
     collectPubApisOfDependencies(context, explicitJFOs);
     deps = getDependencies(context, explicitJFOs, false);
     cpDeps = getDependencies(context, explicitJFOs, true);
   }
 }
Example #5
0
 @Override
 public void finished(TaskEvent e) {
   System.out.println("Finished: " + e);
   if (e.getKind() == TaskEvent.Kind.ANALYZE) {
     for (Runnable r : runnables) {
       System.out.println("running " + r);
       r.run();
     }
   }
 }