当前位置: 首页>>代码示例>>Java>>正文


Java TaskEvent.getKind方法代码示例

本文整理汇总了Java中com.sun.source.util.TaskEvent.getKind方法的典型用法代码示例。如果您正苦于以下问题:Java TaskEvent.getKind方法的具体用法?Java TaskEvent.getKind怎么用?Java TaskEvent.getKind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.source.util.TaskEvent的用法示例。


在下文中一共展示了TaskEvent.getKind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:PublicApiCollector.java

示例2: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:PackageProcessor.java

示例3: started

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void started( TaskEvent e )
{
  switch( e.getKind() )
  {
    case ENTER:
      if( !_initialized )
      {
        _initialized = true;

        // Note there are no "non-java" files to compile in default Manifold,
        // only other languages implementing their own IManifoldHost might compile their language files at this time
        ManifoldHost.initializeAndCompileNonJavaFiles( _fileManager, _gosuInputFiles, this::deriveSourcePath, this::deriveClasspath, this::deriveOutputPath );

        // Need to bootstap for dynamically loading darkj classes Manifold itself uses during compilation e.g., ManClassFinder
        Bootstrap.init();

        // Override javac's ClassFinder and Resolve so that we can safely load class symbols corresponding with extension classes
        hijackJavacCompilerForJava9( e );
      }
      break;
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:24,代码来源:JavacPlugin.java

示例4: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void finished( TaskEvent e )
{
  switch( e.getKind() )
  {
    case PARSE:
    {
      addInputFile( e );
      break;
    }

    case ENTER:
      process( e );
      break;

  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:18,代码来源:JavacPlugin.java

示例5: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@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);
    }
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:20,代码来源:JavacTurbineTest.java

示例6: started

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void started(TaskEvent e) {
  switch (e.getKind()) {
    case ANNOTATION_PROCESSING:
      // The raw event stream from javac will start with this event if there are any APs present
      annotationProcessing = true;
      break;
    case ENTER:
      if (pendingEnterCalls == 0) {
        topLevelElements.clear();
      }
      pendingEnterCalls += 1;
      break;
      // $CASES-OMITTED$
    default:
      break;
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:19,代码来源:PostEnterTaskListener.java

示例7: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void finished(TaskEvent e) {
  final TaskEvent.Kind kind = e.getKind();
  if (kind == TaskEvent.Kind.PARSE) {
    final CompilationUnitTree compilationUnit = e.getCompilationUnit();
    compilationUnits.add(compilationUnit);
  } else if (kind == TaskEvent.Kind.ENTER) {
    enterDepth -= 1;
    // We wait until we've received all enter events so that the validation time shows up
    // separately from compiler enter time in the traces. We wait until after annotation
    // processing so we catch all the types.
    if (!annotationProcessing && enterDepth == 0 && !errorsExist.get()) {
      getValidator().validate(compilationUnits);
    }
  } else if (kind == TaskEvent.Kind.ANNOTATION_PROCESSING) {
    annotationProcessing = false;
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:19,代码来源:ValidatingTaskListener.java

示例8: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@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;
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:18,代码来源:PostEnterCallback.java

示例9: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void finished(TaskEvent e) {
    if (e.getKind() != TaskEvent.Kind.ANALYZE) return;
    TypeElement elem = e.getTypeElement();
    for(Tree t : e.getCompilationUnit().getTypeDecls()) {
        if (t.getKind() == Tree.Kind.CLASS) {
            if (((JCClassDecl)t).sym.equals(elem)) {
                currentClass = (ClassTree)t;
                break;
            }
        }
    }
    if (currentClass != null) {
        verify(currentClass, elem);
    }
}
 
开发者ID:haitaoyao,项目名称:btrace,代码行数:17,代码来源:Verifier.java

示例10: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@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());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:JavacFlowListener.java

示例11: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
/**
 * Kicks off the scan if we've just finished the analyze phase
 * @param e event
 */
@Override
public void finished(TaskEvent e) {
    TaskEvent.Kind kind = e.getKind();
    if (kind == TaskEvent.Kind.ANALYZE) {
        // visit all of the classes to see if their method params are explicitly or effectively final
        CompilationUnitTree compilationUnit = e.getCompilationUnit();
        visitor.scan(compilationUnit, null);
    }
}
 
开发者ID:massfords,项目名称:effectively-final,代码行数:14,代码来源:EffectivelyFinalTaskListener.java

示例12: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:NewDependencyCollector.java

示例13: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@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();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TestClose.java

示例14: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void finished(TaskEvent e) {
    if (e.getKind() != TaskEvent.Kind.ANALYZE)
        return;

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

    System.out.println(INDICATOR);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TypeProcOnly.java

示例15: started

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void started( TaskEvent e )
{
  if( e.getKind() != TaskEvent.Kind.GENERATE )
  {
    return;
  }

  //
  // Process trees that were generated and therefore not available during ANALYZE
  // For instance, we must process bridge methods
  //

  TypeElement elem = e.getTypeElement();

  if( elem instanceof Symbol.ClassSymbol )
  {
    if( _typesToProcess.containsKey( elem.getQualifiedName().toString() ) )
    {
      _tree = findTopLevel( (Symbol.ClassSymbol)elem, e.getCompilationUnit().getTypeDecls() );
    }
    else
    {
      _tree = _innerClassForGeneration.get( ((Symbol.ClassSymbol)elem).flatName().toString() );
    }

    if( _tree != null )
    {
      _compilationUnit = e.getCompilationUnit();
      _generate = true;
      process( elem, _issueReporter );
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:35,代码来源:CompiledTypeProcessor.java


注:本文中的com.sun.source.util.TaskEvent.getKind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。