Java Code Examples for com.sun.source.util.TaskEvent.Kind#ANALYZE

The following examples show how to use com.sun.source.util.TaskEvent.Kind#ANALYZE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeptectivePlugin.java    From deptective with Apache License 2.0 6 votes vote down vote up
private TaskEventKind getTaskEventKind(TaskEvent.Kind kind, int totalSourceFiles, int analyzedSourceFiles) {
    if (kind == Kind.PARSE) {
        return TaskEventKind.PARSE;
    }
    else if (kind == Kind.ANALYZE) {
        if (!HAS_KIND_COMPILATION && analyzedSourceFiles >= totalSourceFiles - 1) {
            return TaskEventKind.LAST_ANALYZE;
        }
        else {
            return TaskEventKind.ANALYZE;
        }

    }
    else if (kind.name().equals("COMPILATION")) {
        return TaskEventKind.COMPILATION;
    }
    else {
        return TaskEventKind.OTHER;
    }
}
 
Example 2
Source File: DeptectivePlugin.java    From deptective with Apache License 2.0 6 votes vote down vote up
private TaskEventKind getTaskEventKind(TaskEvent.Kind kind, int totalSourceFiles, int analyzedSourceFiles) {
    if (kind == Kind.PARSE) {
        return TaskEventKind.PARSE;
    }
    else if (kind == Kind.ANALYZE) {
        if (!HAS_KIND_COMPILATION && analyzedSourceFiles >= totalSourceFiles - 1) {
            return TaskEventKind.LAST_ANALYZE;
        }
        else {
            return TaskEventKind.ANALYZE;
        }

    }
    else if (kind.name().equals("COMPILATION")) {
        return TaskEventKind.COMPILATION;
    }
    else {
        return TaskEventKind.OTHER;
    }
}
 
Example 3
Source File: JavacTurbineTest.java    From bazel with Apache License 2.0 6 votes vote down vote up
@Override
public void finished(TaskEvent e) {
  if (e.getKind() == Kind.ANALYZE) {
    e.getCompilationUnit().accept(new Scanner(), null);
  } else if (e.getKind() == Kind.GENERATE) {
    try {
      FileObject file =
          processingEnv
              .getFiler()
              .createResource(
                  StandardLocation.CLASS_OUTPUT, "", "output.txt", e.getTypeElement());
      try (OutputStream os = file.openOutputStream()) {
        os.write(values.toString().getBytes(UTF_8));
      }
    } catch (IOException exception) {
      throw new IOError(exception);
    }
  }
}
 
Example 4
Source File: JavacFlowListener.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void finished(TaskEvent e) {
    if (e.getKind() == Kind.ANALYZE) {
        JCCompilationUnit toplevel = (JCCompilationUnit) e.getCompilationUnit();
        if (toplevel != null && toplevel.sourcefile != null) {
            flowCompleted.add(toplevel.sourcefile.toUri());
        }
    }
}
 
Example 5
Source File: MutableFieldsAnalyzer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public MutableFieldsAnalyzer(JavacTask task) {
    super(task);
    treeVisitor = new MutableFieldsVisitor();
    eventKind = Kind.ANALYZE;
}
 
Example 6
Source File: AssertCheckAnalyzer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public AssertCheckAnalyzer(JavacTask task) {
    super(task);
    treeVisitor = new AssertCheckVisitor();
    eventKind = Kind.ANALYZE;
}
 
Example 7
Source File: DefinedByAnalyzer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public DefinedByAnalyzer(JavacTask task) {
    super(task);
    treeVisitor = new DefinedByVisitor();
    eventKind = Kind.ANALYZE;
}