• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Kind类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Kind类属于com.sun.source.util.TaskEvent包,在下文中一共展示了Kind类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
void test(Iterable<String> options, Iterable<JavaFileObject> files) throws IOException {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    TestListener listener = new TestListener();
    JavacTask task = tool.getTask(pw, fm, null, options, null, files);

    task.setTaskListener(listener);

    task.call();

    for (Entry<Kind, Integer> e : listener.kind2Count.entrySet()) {
        if (e.getValue() != null && e.getValue() != 0) {
            throw new IllegalStateException("Not balanced event: " + e.getKey());
        }
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:17,代码来源:EventsBalancedTest.java


示例2: finished

import com.sun.source.util.TaskEvent.Kind; //导入依赖的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


示例3: finished

import com.sun.source.util.TaskEvent.Kind; //导入依赖的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


示例4: isSimpleStringArg

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
boolean isSimpleStringArg(JCExpression e) {
    switch (e.getTag()) {
        case LAMBDA:
            JCLambda lambda = (JCLambda)e;
            return (lambda.getBodyKind() == BodyKind.EXPRESSION) &&
                    isSimpleStringArg((JCExpression)lambda.body);
        default:
            Symbol argSym = TreeInfo.symbolFor(e);
            return (e.type.constValue() != null ||
                    (argSym != null && argSym.kind == Kinds.Kind.VAR));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:AssertCheckAnalyzer.java


示例5: checkLegacyLogMethod

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
void checkLegacyLogMethod(JCMethodInvocation tree) {
    Symbol method = TreeInfo.symbolFor(tree);
    if (method == null ||
        method.kind != Kinds.Kind.MTH ||
        !typeToCheck(method.owner.type) ||
        !LEGACY_METHOD_NAMES.contains(method.name.toString()) ||
        !((MethodSymbol) method).isVarArgs() ||
        method.type.getParameterTypes().size() < 2) {
        return ;
    }
    JCExpression key = tree.args.get(method.type.getParameterTypes().size() - 2);
    if (key.hasTag(Tag.LITERAL)) {
        messages.error(tree, "crules.use.of.legacy.log.method", tree);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:LegacyLogMethodAnalyzer.java


示例6: visitBlock

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
@Override
public Void visitBlock(BlockTree node, Void p) {
    if (getCurrentPath().getParentPath().getLeaf().getKind() != Tree.Kind.CLASS) {
        return super.visitBlock(node, p);
    }
    Element prevOwner = currentOwner;
    try {
        currentOwner = null;
        return super.visitBlock(node, p);
    } finally {
        currentOwner = prevOwner;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:LocalInAnonymous.java


示例7: test

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
void test(List<String> options, List<JavaFileObject> files) throws IOException {
    System.err.println("testing: " + options + ", " + files);
    TestListener listener = new TestListener();
    JavacTask task = tool.getTask(null, fm, null, options, null, files);

    task.setTaskListener(listener);

    task.call();

    for (Entry<Kind, Integer> e : listener.kind2Count.entrySet()) {
        if (e.getValue() != null && e.getValue() != 0) {
            throw new IllegalStateException("Not balanced event: " + e.getKey());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:EventsBalancedTest.java


示例8: get

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
int get(Kind k) {
    Integer count = kind2Count.get(k);

    if (count == null)
        kind2Count.put(k, count = 0);

    return count;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:EventsBalancedTest.java


示例9: visitClass

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
@Override
public Void visitClass(ClassTree node, Symtab syms) {
    Symbol sym = ((JCClassDecl)node).sym;
    if (sym != null) {
        syms.removeClass(sym.packge().modle, sym.flatName());
        Type sup = supertype(sym);
        if (isCoreClass(sym) ||
                (sup != null && isCoreClass(sup.tsym) && sup.tsym.kind != Kinds.Kind.TYP)) {
            polluted = true;
        }
    }
    return super.visitClass(node, syms);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ReusableContext.java


示例10: report

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
    List<Diagnostic<? extends JavaFileObject>> diags =
            diagsByKeys.getOrDefault(diagnostic.getCode(), List.nil());
    diagsByKeys.put(diagnostic.getCode(), diags.prepend(diagnostic));
    Diagnostic.Kind kind = diagnostic.getKind();
    diags = diagsByKind.getOrDefault(kind, List.nil());
    diagsByKind.put(kind, diags.prepend(diagnostic));
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:9,代码来源:ComboTask.java


示例11: postFlow

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
/** Run Error Prone analysis after performing dataflow checks. */
@Override
public void postFlow(Env<AttrContext> env) {
  try {
    errorProneAnalyzer.finished(new TaskEvent(Kind.ANALYZE, env.toplevel, env.enclClass.sym));
  } catch (ErrorProneError e) {
    e.logFatalError(log);
    // let the exception propagate to javac's main, where it will cause the compilation to
    // terminate with Result.ABNORMAL
    throw e;
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:13,代码来源:ErrorPronePlugin.java


示例12: getEntries

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
private Map<String, Deps.Dependency.Kind> getEntries(Deps.Dependencies deps) {
  Map<String, Deps.Dependency.Kind> result = new LinkedHashMap<>();
  for (Dependency dep : deps.getDependencyList()) {
    result.put(dep.getPath(), dep.getKind());
  }
  return result;
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:8,代码来源:JavacTurbineTest.java


示例13: MutableFieldsAnalyzer

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public MutableFieldsAnalyzer(JavacTask task) {
    super(task);
    treeVisitor = new MutableFieldsVisitor();
    eventKind = Kind.ANALYZE;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:MutableFieldsAnalyzer.java


示例14: AssertCheckAnalyzer

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public AssertCheckAnalyzer(JavacTask task) {
    super(task);
    treeVisitor = new AssertCheckVisitor();
    eventKind = Kind.ANALYZE;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:AssertCheckAnalyzer.java


示例15: LegacyLogMethodAnalyzer

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public LegacyLogMethodAnalyzer(JavacTask task) {
    super(task);
    treeVisitor = new LegacyLogMethodVisitor();
    eventKind = Kind.ANALYZE;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:LegacyLogMethodAnalyzer.java


示例16: DefinedByAnalyzer

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public DefinedByAnalyzer(JavacTask task) {
    super(task);
    treeVisitor = new DefinedByVisitor();
    eventKind = Kind.ANALYZE;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:DefinedByAnalyzer.java


示例17: TJFO

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public TJFO(String name, String code) throws URISyntaxException {
    super(new URI("mem:///" + name + ".java"), Kind.SOURCE);
    this.code = code;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:LocalInAnonymous.java


示例18: TestSource

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public TestSource(String fileName, String content) {
    super(URI.create("myfo:/" + fileName + ".java"), JavaFileObject.Kind.SOURCE);
    this.content = content;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:EventsBalancedTest.java


示例19: finished

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
@Override
public void finished(TaskEvent e) {
    if (e.getKind() == Kind.PARSE) {
        roots.add(e.getCompilationUnit());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:ReusableContext.java


示例20: started

import com.sun.source.util.TaskEvent.Kind; //导入依赖的package包/类
public void started(TaskEvent e) {
    if (e.getKind() != Kind.COMPILATION) {
        throw new AssertionError("Unexpected TaskListener event: " + e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:T6395974.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DexPool类代码示例发布时间:2022-05-22
下一篇:
Java WXComponent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap