本文整理汇总了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;
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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());
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
}
示例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);
}
示例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 );
}
}
}