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


Java TaskEvent.getTypeElement方法代码示例

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


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

示例1: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public void finished(TaskEvent taskEvent) {
    List<AbstractCodingRulesAnalyzer> currentAnalyzers = this.analyzers.get(taskEvent.getKind());

    if (currentAnalyzers != null) {
        TypeElement typeElem = taskEvent.getTypeElement();
        Tree tree = trees.getTree(typeElem);
        if (tree != null) {
            JavaFileObject prevSource = log.currentSourceFile();
            try {
                log.useSource(taskEvent.getCompilationUnit().getSourceFile());
                for (AbstractCodingRulesAnalyzer analyzer : currentAnalyzers) {
                    analyzer.treeVisitor.scan((JCTree)tree);
                }
            } finally {
                log.useSource(prevSource);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:CodingRulesAnalyzerPlugin.java

示例2: finished

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
@Override
public void finished(TaskEvent taskEvent) {
    if (taskEvent.getKind().equals(eventKind)) {
        TypeElement typeElem = taskEvent.getTypeElement();
        Tree tree = trees.getTree(typeElem);
        if (tree != null) {
            JavaFileObject prevSource = log.currentSourceFile();
            try {
                log.useSource(taskEvent.getCompilationUnit().getSourceFile());
                treeVisitor.scan((JCTree)tree);
            } finally {
                log.useSource(prevSource);
            }
        }
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:17,代码来源:AbstractCodingRulesAnalyzer.java

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

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

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

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

示例7: mirrorTaskEvent

import com.sun.source.util.TaskEvent; //导入方法依赖的package包/类
private TaskEventMirror mirrorTaskEvent(TaskEvent e) {
  return new TaskEventMirror(
      e,
      mirrorKind(e.getKind()),
      e.getSourceFile(),
      proxyCompilationUnit(e.getCompilationUnit()),
      e.getTypeElement());
}
 
开发者ID:facebook,项目名称:buck,代码行数:9,代码来源:BuckJavacTaskListenerProxy.java

示例8: 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.getTypeElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。