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


Java TaskEvent.getCompilationUnit方法代码示例

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


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

示例1: started

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void started( TaskEvent te )
{
  if( JreUtil.isJava8() )
  {
    return;
  }

  CompilationUnitTree compilationUnit = te.getCompilationUnit();
  if( !(compilationUnit instanceof JCTree.JCCompilationUnit) )
  {
    return;
  }

  if( _done )
  {
    return;
  }

  _done = true;

  openModule( _ctx, "jdk.compiler" );
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:24,代码来源:BootstrapPlugin.java

示例2: addInputFile

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
private void addInputFile( TaskEvent e )
{
  if( !_initialized )
  {
    CompilationUnitTree compilationUnit = e.getCompilationUnit();
    ExpressionTree pkg = compilationUnit.getPackageName();
    String packageQualifier = pkg == null ? "" : (pkg.toString() + '.');
    for( Tree classDecl : compilationUnit.getTypeDecls() )
    {
      if( classDecl instanceof JCTree.JCClassDecl )
      {
        _javaInputFiles.add( new Pair<>( packageQualifier + ((JCTree.JCClassDecl)classDecl).getSimpleName(), compilationUnit.getSourceFile() ) );
      }
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:17,代码来源:JavacPlugin.java

示例3: 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

示例4: 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

示例5: 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

示例6: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void finished(TaskEvent taskEvent) {
    if (taskEvent.getKind().equals(TaskEvent.Kind.ANALYZE)) {
        CompilationUnitTree compilationUnit = taskEvent.getCompilationUnit();
        visitor.scan(compilationUnit, null);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:ShowTypePlugin.java

示例7: 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

示例8: hijackJavacCompilerForJava9

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
private void hijackJavacCompilerForJava9( TaskEvent te )
{
  if( IS_JAVA_8 )
  {
    return;
  }

  CompilationUnitTree compilationUnit = te.getCompilationUnit();
  if( !(compilationUnit instanceof JCTree.JCCompilationUnit) )
  {
    return;
  }

  Symbol module = (Symbol)ReflectUtil.field( compilationUnit, "modle" ).get();
  if( module == null || _seenModules.contains( module ) )
  {
    return;
  }

  _seenModules.add( module );

  BootstrapPlugin.openModule( _ctx, "jdk.compiler" );

  // Override javac's Resolve (lol)
  ReflectUtil.method( ReflectUtil.type( "manifold.internal.javac.ManResolve" ), "instance", Context.class ).invokeStatic( _ctx );

  // Override javac's ClassFinder
  ReflectUtil.method( ReflectUtil.type( "manifold.internal.javac.ManClassFinder" ), "instance", Context.class ).invokeStatic( _ctx );
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:30,代码来源:JavacPlugin.java

示例9: finished

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

    if (!hasInvokedTypeProcessingStart) {
        typeProcessingStart();
        hasInvokedTypeProcessingStart = true;
    }

    Log log = Log.instance(((JavacProcessingEnvironment) processingEnv).getContext());

    if (!hasInvokedTypeProcessingOver && elements.isEmpty() && log.nerrors == 0) {
        typeProcessingOver();
        hasInvokedTypeProcessingOver = true;
    }

    if (e.getTypeElement() == null)
        throw new AssertionError("event task without a type element");
    if (e.getCompilationUnit() == null)
        throw new AssertionError("event task without compilation unit");

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

    TypeElement elem = e.getTypeElement();
    TreePath p = Trees.instance(processingEnv).getPath(elem);

    typeProcess(elem, p);

    if (!hasInvokedTypeProcessingOver && elements.isEmpty() && log.nerrors == 0) {
        typeProcessingOver();
        hasInvokedTypeProcessingOver = true;
    }
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:36,代码来源:AbstractTypeProcessor.java

示例10: finished

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

    if (!hasInvokedTypeProcessingStart) {
        typeProcessingStart();
        hasInvokedTypeProcessingStart = true;
    }

    Log log = Log.instance(((JavacProcessingEnvironment) processingEnv).getContext());

    if (!hasInvokedTypeProcessingOver && elements.isEmpty() && log.nerrors == 0) {
        typeProcessingOver();
        hasInvokedTypeProcessingOver = true;
    }

    if (e.getTypeElement() == null) {
        throw new AssertionError("event task without a type element");
    }
    if (e.getCompilationUnit() == null) {
        throw new AssertionError("event task without compilation unit");
    }

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

    TypeElement elem = e.getTypeElement();
    TreePath p = Trees.instance(processingEnv).getPath(elem);

    typeProcess(elem, p);

    if (!hasInvokedTypeProcessingOver && elements.isEmpty() && log.nerrors == 0) {
        typeProcessingOver();
        hasInvokedTypeProcessingOver = true;
    }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:40,代码来源:AbstractTypeProcessor.java

示例11: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void finished(TaskEvent arg0) {

    if (arg0.getKind().toString().equals("ANALYZE")) {
        CompilationUnitTree u = arg0.getCompilationUnit();
        GraphDatabaseService graphDb = graphDbBuilder.newGraphDatabase();
        new WiggleVisitor(task, graphDb, cuProps).scan(u, null);
        graphDb.shutdown();
    }
}
 
开发者ID:raoulDoc,项目名称:WiggleIndexer,代码行数:11,代码来源:AfterAnalyze.java

示例12: started

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void started(TaskEvent taskEvent) {
    if (taskEvent.getKind().equals(TaskEvent.Kind.ENTER)) {
        CompilationUnitTree compilationUnit = taskEvent.getCompilationUnit();
        visitor.scan(compilationUnit, null);
    }
}
 
开发者ID:gzlabs,项目名称:hightide,代码行数:8,代码来源:CompilerTaskListener.java

示例13: started

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

示例14: finished

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

示例15: finished

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

    //
    // Process fully analyzed trees (full type information is in the trees)
    //

    _generate = false;

    String fqn = e.getTypeElement().getQualifiedName().toString();
    Boolean visited = _typesToProcess.get( fqn );
    if( visited == Boolean.TRUE )
    {
      // already processed
      return;
    }
//    if( visited == null && !isNested( e.getTypeElement().getEnclosingElement() ) && !isOuter( fqn ) )
//    {
//      // also process inner types of types to process and (outer type if processing inner type first)
//      return;
//    }

    if( fqn.isEmpty() )
    {
      return;
    }
    
    // mark processed
    _typesToProcess.put( fqn, true );

    _compilationUnit = e.getCompilationUnit();

    TypeElement elem = e.getTypeElement();
    _tree = (JCTree.JCClassDecl)getTreeUtil().getTree( elem );
    preserveInnerClassesForGeneration( _tree );

    process( elem, _issueReporter );
  }
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:44,代码来源:CompiledTypeProcessor.java


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