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


Java CompileState类代码示例

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


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

示例1: parseFiles

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
  * Parses a list of files.
  */
public List<JCCompilationUnit> parseFiles(Iterable<JavaFileObject> fileObjects) {
    if (shouldStop(CompileState.PARSE))
        return List.nil();

     //parse all files
     ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
     Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
     for (JavaFileObject fileObject : fileObjects) {
         if (!filesSoFar.contains(fileObject)) {
             filesSoFar.add(fileObject);
             trees.append(parse(fileObject));
         }
     }
     return trees.toList();
 }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:JavaCompiler.java

示例2: parseFiles

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
  * Parses a list of files.
  */
public List<JCCompilationUnit> parseFiles(Iterable<JavaFileObject> fileObjects) {
    if (shouldStop(CompileState.PARSE))
        return List.nil();

     //parse all files
     ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
     Set<JavaFileObject> filesSoFar = new HashSet<>();
     for (JavaFileObject fileObject : fileObjects) {
         if (!filesSoFar.contains(fileObject)) {
             filesSoFar.add(fileObject);
             trees.append(parse(fileObject));
         }
     }
     return trees.toList();
 }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:JavaCompiler.java

示例3: test

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
void test() throws IOException {
    TestSource a = new TestSource("B", "class B extends A { }");
    TestSource b = new TestSource("A", "abstract class A { }");

    test(null, Arrays.asList(a, b));
    test(null, Arrays.asList(b, a));

    for (CompileState stop : CompileState.values()) {
        test(Arrays.asList("--should-stop:ifNoError=" + stop,
                           "--should-stop:ifError=" + stop),
             Arrays.asList(a, b));
        test(Arrays.asList("--should-stop:ifNoError=" + stop,
                           "--should-stop:ifError=" + stop),
             Arrays.asList(b, a));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:EventsBalancedTest.java

示例4: CompiledTypeProcessor

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
CompiledTypeProcessor( JavacTask javacTask )
  {
    _javacTask = javacTask;
    javacTask.addTaskListener( this );
    Context context = ((BasicJavacTask)javacTask).getContext();
    JavaCompiler compiler = JavaCompiler.instance( context );
    compiler.shouldStopPolicyIfNoError = CompileState.max( compiler.shouldStopPolicyIfNoError, CompileState.FLOW );
    _issueReporter = new IssueReporter<>( Log.instance( context ) );
    _types = Types.instance( context );
//    DiagnosticListener dl = context.get( DiagnosticListener.class );
//    context.put( DiagnosticListener.class, (DiagnosticListener)null );
//    context.put( DiagnosticListener.class, new WrappedDiagnosticListener( dl ) );

    _typesToProcess = new HashMap<>();
    _innerClassForGeneration = new HashMap<>();
  }
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:17,代码来源:CompiledTypeProcessor.java

示例5: test

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
void test() throws IOException {
    TestSource a = new TestSource("B", "class B extends A { }");
    TestSource b = new TestSource("A", "abstract class A { }");

    test(null, Arrays.asList(a, b));
    test(null, Arrays.asList(b, a));

    for (CompileState stop : CompileState.values()) {
        test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop,
                           "-XDshouldStopPolicyIfError=" + stop),
             Arrays.asList(a, b));
        test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop,
                           "-XDshouldStopPolicyIfError=" + stop),
             Arrays.asList(b, a));
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:17,代码来源:EventsBalancedTest.java

示例6: parseFiles

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Parses a list of files.
 */
public List<JCCompilationUnit> parseFiles(Iterable<JavaFileObject> fileObjects) {
    if (shouldStop(CompileState.PARSE))
        return List.nil();

    //parse all files
    ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
    Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
    for (JavaFileObject fileObject : fileObjects) {
        if (!filesSoFar.contains(fileObject)) {
            filesSoFar.add(fileObject);
            trees.append(parse(fileObject));
        }
    }
    return trees.toList();
}
 
开发者ID:georgewfraser,项目名称:vscode-javac,代码行数:19,代码来源:LargeFile.java

示例7: test

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
void test() throws IOException {
    TestSource a = new TestSource("B", "class B extends A { }");
    TestSource b = new TestSource("A", "abstract class A { }");

    test(null, Arrays.asList(a, b));
    test(null, Arrays.asList(b, a));
    test(Arrays.asList("-XD-relax"), Arrays.asList(a, b));
    test(Arrays.asList("-XD-relax"), Arrays.asList(b, a));

    for (CompileState stop : CompileState.values()) {
        test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop,
                           "-XDshouldStopPolicyIfError=" + stop),
             Arrays.asList(a, b));
        test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop,
                           "-XDshouldStopPolicyIfError=" + stop),
             Arrays.asList(b, a));
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:19,代码来源:EventsBalancedTest.java

示例8: flow

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
@Override
protected void flow(Env<AttrContext> env, Queue<Env<AttrContext>> results) {
  boolean isDone = compileStates.isDone(env, CompileState.FLOW);
  super.flow(env, results);
  if (isDone) {
    return;
  }
  // don't run plugins if there were compilation errors
  if (errorCount() > 0) {
    skippedFlowEvents++;
    return;
  }
  flowEvents++;

  // Iterate over all plugins, calling their postFlow methods
  for (BlazeJavaCompilerPlugin plugin : plugins) {
    plugin.postFlow(env);
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:20,代码来源:BlazeJavaCompiler.java

示例9: compile

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Main method: compile a list of files, return all compiled classes
 *
 * @param sourceFileObjects file objects to be compiled
 * @param classnames class names to process for annotations
 * @param processors user provided annotation processors to bypass
 * discovery, {@code null} means that no processors were provided
 */
public void compile(List<JavaFileObject> sourceFileObjects,
                    List<String> classnames,
                    Iterable<? extends Processor> processors)
{
    if (processors != null && processors.iterator().hasNext())
        explicitAnnotationProcessingRequested = true;
    // as a JavaCompiler can only be used once, throw an exception if
    // it has been used before.
    if (hasBeenUsed)
        throw new AssertionError("attempt to reuse JavaCompiler");
    hasBeenUsed = true;

    // forcibly set the equivalent of -Xlint:-options, so that no further
    // warnings about command line options are generated from this point on
    options.put(XLINT_CUSTOM.text + "-" + LintCategory.OPTIONS.option, "true");
    options.remove(XLINT_CUSTOM.text + LintCategory.OPTIONS.option);

    start_msec = now();

    try {
        initProcessAnnotations(processors);

        // These method calls must be chained to avoid memory leaks
        delegateCompiler =
            processAnnotations(
                enterTrees(stopIfError(CompileState.PARSE, parseFiles(sourceFileObjects))),
                classnames);

        delegateCompiler.compile2();
        delegateCompiler.close();
        elapsed_msec = delegateCompiler.elapsed_msec;
    } catch (Abort ex) {
        if (devVerbose)
            ex.printStackTrace(System.err);
    } finally {
        if (procEnvImpl != null)
            procEnvImpl.close();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:JavaCompiler.java

示例10: attribute

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Attribute a parse tree.
 * @returns the attributed parse tree
 */
public Env<AttrContext> attribute(Env<AttrContext> env) {
    if (compileStates.isDone(env, CompileState.ATTR))
        return env;

    if (verboseCompilePolicy)
        printNote("[attribute " + env.enclClass.sym + "]");
    if (verbose)
        log.printVerbose("checking.attribution", env.enclClass.sym);

    if (!taskListener.isEmpty()) {
        TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
        taskListener.started(e);
    }

    JavaFileObject prev = log.useSource(
                              env.enclClass.sym.sourcefile != null ?
                              env.enclClass.sym.sourcefile :
                              env.toplevel.sourcefile);
    try {
        attr.attrib(env);
        if (errorCount() > 0 && !shouldStop(CompileState.ATTR)) {
            //if in fail-over mode, ensure that AST expression nodes
            //are correctly initialized (e.g. they have a type/symbol)
            attr.postAttr(env.tree);
        }
        compileStates.put(env, CompileState.ATTR);
        if (rootClasses != null && rootClasses.contains(env.enclClass)) {
            // This was a class that was explicitly supplied for compilation.
            // If we want to capture the public api of this class,
            // then now is a good time to do it.
            reportPublicApi(env.enclClass.sym);
        }
    }
    finally {
        log.useSource(prev);
    }

    return env;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:JavaCompiler.java

示例11: flow

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Perform dataflow checks on attributed parse trees.
 * These include checks for definite assignment and unreachable statements.
 * If any errors occur, an empty list will be returned.
 * @returns the list of attributed parse trees
 */
public Queue<Env<AttrContext>> flow(Queue<Env<AttrContext>> envs) {
    ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
    for (Env<AttrContext> env: envs) {
        flow(env, results);
    }
    return stopIfError(CompileState.FLOW, results);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:JavaCompiler.java

示例12: desugar

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Prepare attributed parse trees, in conjunction with their attribution contexts,
 * for source or code generation.
 * If any errors occur, an empty list will be returned.
 * @returns a list containing the classes to be generated
 */
public Queue<Pair<Env<AttrContext>, JCClassDecl>> desugar(Queue<Env<AttrContext>> envs) {
    ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results = new ListBuffer<>();
    for (Env<AttrContext> env: envs)
        desugar(env, results);
    return stopIfError(CompileState.FLOW, results);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:JavaCompiler.java

示例13: attribute

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Attribute a parse tree.
 * @return the attributed parse tree
 */
public Env<AttrContext> attribute(Env<AttrContext> env) {
    if (compileStates.isDone(env, CompileState.ATTR))
        return env;

    if (verboseCompilePolicy)
        printNote("[attribute " + env.enclClass.sym + "]");
    if (verbose)
        log.printVerbose("checking.attribution", env.enclClass.sym);

    if (!taskListener.isEmpty()) {
        TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
        taskListener.started(e);
    }

    JavaFileObject prev = log.useSource(
                              env.enclClass.sym.sourcefile != null ?
                              env.enclClass.sym.sourcefile :
                              env.toplevel.sourcefile);
    try {
        attr.attrib(env);
        if (errorCount() > 0 && !shouldStop(CompileState.ATTR)) {
            //if in fail-over mode, ensure that AST expression nodes
            //are correctly initialized (e.g. they have a type/symbol)
            attr.postAttr(env.tree);
        }
        compileStates.put(env, CompileState.ATTR);
    }
    finally {
        log.useSource(prev);
    }

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

示例14: flow

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Perform dataflow checks on attributed parse trees.
 * These include checks for definite assignment and unreachable statements.
 * If any errors occur, an empty list will be returned.
 * @return the list of attributed parse trees
 */
public Queue<Env<AttrContext>> flow(Queue<Env<AttrContext>> envs) {
    ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
    for (Env<AttrContext> env: envs) {
        flow(env, results);
    }
    return stopIfError(CompileState.FLOW, results);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:JavaCompiler.java

示例15: desugar

import com.sun.tools.javac.comp.CompileStates.CompileState; //导入依赖的package包/类
/**
 * Prepare attributed parse trees, in conjunction with their attribution contexts,
 * for source or code generation.
 * If any errors occur, an empty list will be returned.
 * @return a list containing the classes to be generated
 */
public Queue<Pair<Env<AttrContext>, JCClassDecl>> desugar(Queue<Env<AttrContext>> envs) {
    ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results = new ListBuffer<>();
    for (Env<AttrContext> env: envs)
        desugar(env, results);
    return stopIfError(CompileState.FLOW, results);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JavaCompiler.java


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