Java Code Examples for com.sun.source.util.TaskEvent#getKind()

The following examples show how to use com.sun.source.util.TaskEvent#getKind() . 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: PublicApiCollector.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
@DefinedBy(Api.COMPILER_TREE)
public void finished(TaskEvent e) {
    switch (e.getKind()) {
    case ANALYZE:
        collectClassSymbols((JCCompilationUnit) e.getCompilationUnit());
        break;
    case COMPILATION:
        Log.debug("Compilation finished");
        Log.debug("Extracting pub APIs for the following symbols:");
        for (ClassSymbol cs : classSymbols)
            Log.debug("    " + cs.fullname);
        extractPubApis();

        // Save result for later retrieval. (Important that we do this
        // before we return from this method, because we may not access
        // symbols after compilation is finished.)
        PubAPIs pa = PubAPIs.instance(context);
        explicitPubApis = pa.getPubapis(explicitJFOs, true);
        nonExplicitPubApis = pa.getPubapis(explicitJFOs, false);

        Log.debug("done");
        break;
    }
}
 
Example 2
Source File: PackageProcessor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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);
    }
}
 
Example 3
Source File: PackageProcessor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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);
    }
}
 
Example 4
Source File: PackageProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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);
    }
}
 
Example 5
Source File: PackageProcessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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);
    }
}
 
Example 6
Source File: PostEnterCallback.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public void finished(TaskEvent e) {
  switch (e.getKind()) {
    case PARSE:
      compilationUnits.add(e.getCompilationUnit());
      break;
    case ENTER:
      enterCount -= 1;
      if (enterCount == 0) {
        enterComplete(compilationUnits);
      }
      break;
      // $CASES-OMITTED$
    default:
      break;
  }
}
 
Example 7
Source File: TypeProcOnly.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void finished(TaskEvent e) {
    if (e.getKind() != TaskEvent.Kind.ANALYZE)
        return;

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

    System.out.println(INDICATOR);
}
 
Example 8
Source File: TypeProcOnly.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void finished(TaskEvent e) {
    if (e.getKind() != TaskEvent.Kind.ANALYZE)
        return;

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

    System.out.println(INDICATOR);
}
 
Example 9
Source File: TypeProcOnly.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void finished(TaskEvent e) {
    if (e.getKind() != TaskEvent.Kind.ANALYZE)
        return;

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

    System.out.println(INDICATOR);
}
 
Example 10
Source File: NewDependencyCollector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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 11
Source File: TestClose.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@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();
        }
    }
}
 
Example 12
Source File: EnteringPlugin.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public void started(TaskEvent e) {
  if (e.getKind() == TaskEvent.Kind.ENTER) {
    entersInProgress += 1;
    if (classesEnteredThisRound == 0) {
      // We want to clear our tables between rounds, and leave them intact after the last enter
      // phase. However, javac sends the round start after the enter phase, so we must do some
      // bookkeeping to detect the first enter event *after* a round and clear the table then.
      elements.clear();
      trees.clear();
    }
  }
}
 
Example 13
Source File: TestClose.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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();
        }
    }
}
 
Example 14
Source File: Test.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void started(TaskEvent e) {
    if (e.getKind() == TaskEvent.Kind.ANALYZE)
        checker.scan(new TreePath(e.getCompilationUnit()), null);
}
 
Example 15
Source File: TestInvokeDynamic.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void finished(TaskEvent e) {
    if (e.getKind() == TaskEvent.Kind.ANALYZE) {
        scan(e.getCompilationUnit(), null);
    }
}
 
Example 16
Source File: Test.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void started(TaskEvent e) {
    if (e.getKind() == TaskEvent.Kind.ANALYZE)
        checker.scan(new TreePath(e.getCompilationUnit()), null);
}
 
Example 17
Source File: PostEnterCallback.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public void started(TaskEvent e) {
  if (e.getKind() == TaskEvent.Kind.ENTER) {
    enterCount += 1;
  }
}
 
Example 18
Source File: Test.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void started(TaskEvent e) {
    if (e.getKind() == TaskEvent.Kind.ANALYZE)
        checker.scan(new TreePath(e.getCompilationUnit()), null);
}
 
Example 19
Source File: TestInvokeDynamic.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void finished(TaskEvent e) {
    if (e.getKind() == TaskEvent.Kind.ANALYZE) {
        scan(e.getCompilationUnit(), null);
    }
}
 
Example 20
Source File: TestBootstrapMethodsCount.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void finished(TaskEvent e) {
    if (e.getKind() == TaskEvent.Kind.ANALYZE) {
        scan(e.getCompilationUnit(), null);
    }
}