com.sun.tools.javac.main.JavaCompiler.errorCount()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中com.sun.tools.javac.main.JavaCompiler.errorCount()方法的一些代码示例,展示了JavaCompiler.errorCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaCompiler.errorCount()方法的具体详情如下:
包路径:com.sun.tools.javac.main.JavaCompiler
类名称:JavaCompiler
方法名:errorCount

JavaCompiler.errorCount介绍

[英]The number of errors reported so far.
[中]到目前为止报告的错误数。

代码示例

代码示例来源:origin: google/error-prone

return;
if (JavaCompiler.instance(context).errorCount() > 0) {
 return;

代码示例来源:origin: google/error-prone

return;
if (JavaCompiler.instance(context).errorCount() > errorProneErrors) {
 return;

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/** Return the number of errors found so far in this round.
 * This may include uncoverable errors, such as parse errors,
 * and transient errors, such as missing symbols. */
int errorCount() {
  return compiler.errorCount();
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** The number of errors reported so far.
 */
public int errorCount() {
  if (delegateCompiler != null && delegateCompiler != this)
    return delegateCompiler.errorCount();
  else
    return log.nerrors;
}

代码示例来源:origin: konsoletyper/teavm-javac

/** Return the number of errors found so far in this round.
 * This may include uncoverable errors, such as parse errors,
 * and transient errors, such as missing symbols. */
int errorCount() {
  return compiler.errorCount();
}

代码示例来源:origin: konsoletyper/teavm-javac

/** The number of errors reported so far.
 */
public int errorCount() {
  if (delegateCompiler != null && delegateCompiler != this)
    return delegateCompiler.errorCount();
  else {
    if (werror && log.nerrors == 0 && log.nwarnings > 0) {
      log.error("warnings.and.werror");
    }
  }
  return log.nerrors;
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/** The number of errors reported so far.
 */
public int errorCount() {
  if (delegateCompiler != null && delegateCompiler != this)
    return delegateCompiler.errorCount();
  else {
    if (werror && log.nerrors == 0 && log.nwarnings > 0) {
      log.error("warnings.and.werror");
    }
  }
  return log.nerrors;
}

代码示例来源:origin: sc.fiji/javac

/** The number of errors reported so far.
 */
public int errorCount() {
  if (delegateCompiler != null && delegateCompiler != this)
    return delegateCompiler.errorCount();
  else {
    if (werror && log.nerrors == 0 && log.nwarnings > 0) {
      log.error("warnings.and.werror");
    }
    return log.nerrors;
  }
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

protected final <T> List<T> stopIfError(List<T> list) {
  if (errorCount() == 0)
    return list;
  else
    return List.nil();
}

代码示例来源:origin: konsoletyper/teavm-javac

protected boolean shouldStop(CompileState cs) {
  CompileState shouldStopPolicy = (errorCount() > 0 || unrecoverableError())
    ? shouldStopPolicyIfError
    : shouldStopPolicyIfNoError;
  return cs.isAfter(shouldStopPolicy);
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

protected final <T> List<T> stopIfError(ListBuffer<T> listBuffer) {
  if (errorCount() == 0)
    return listBuffer.toList();
  else
    return List.nil();
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

protected boolean shouldStop(CompileState cs) {
  CompileState shouldStopPolicy = (errorCount() > 0 || unrecoverableError())
    ? shouldStopPolicyIfError
    : shouldStopPolicyIfNoError;
  return cs.isAfter(shouldStopPolicy);
}

代码示例来源:origin: sc.fiji/javac

protected boolean shouldStop(CompileState cs) {
  if (shouldStopPolicy == null)
    return (errorCount() > 0);
  else
    return cs.ordinal() > shouldStopPolicy.ordinal();
}

代码示例来源:origin: com.google.errorprone/error_prone_refaster

return;
if (JavaCompiler.instance(context).errorCount() > 0) {
 return;

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/**
 * Parses a list of files.
 */
public List<JCCompilationUnit> parseFiles(List<JavaFileObject> fileObjects) throws IOException {
  if (errorCount() > 0)
     return List.nil();
  //parse all files
  ListBuffer<JCCompilationUnit> trees = lb();
  for (JavaFileObject fileObject : fileObjects)
    trees.append(parse(fileObject));
  return trees.toList();
}

代码示例来源:origin: konsoletyper/teavm-javac

public void reportDeferredDiagnostics() {
  if (errorCount() == 0
      && annotationProcessingOccurred
      && implicitSourceFilesRead
      && implicitSourcePolicy == ImplicitSourcePolicy.UNSET) {
    if (explicitAnnotationProcessingRequested())
      log.warning("proc.use.implicit");
    else
      log.warning("proc.use.proc.or.implicit");
  }
  chk.reportDeferredDiagnostics();
  if (log.compressedOutput) {
    log.mandatoryNote(null, "compressed.diags");
  }
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

public void reportDeferredDiagnostics() {
  if (errorCount() == 0
      && annotationProcessingOccurred
      && implicitSourceFilesRead
      && implicitSourcePolicy == ImplicitSourcePolicy.UNSET) {
    if (explicitAnnotationProcessingRequested())
      log.warning("proc.use.implicit");
    else
      log.warning("proc.use.proc.or.implicit");
  }
  chk.reportDeferredDiagnostics();
  if (log.compressedOutput) {
    log.mandatoryNote(null, "compressed.diags");
  }
}

代码示例来源:origin: sc.fiji/javac

/** Generate code and emit a class file for a given class
 *  @param env    The attribution environment of the outermost class
 *                containing this class.
 *  @param cdef   The class definition from which code is generated.
 */
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
  try {
    if (gen.genClass(env, cdef) && (errorCount() == 0))
      return writer.writeClass(cdef.sym);
  } catch (ClassWriter.PoolOverflow ex) {
    log.error(cdef.pos(), "limit.pool");
  } catch (ClassWriter.StringOverflow ex) {
    log.error(cdef.pos(), "limit.string.overflow",
         ex.value.substring(0, 20));
  } catch (CompletionFailure ex) {
    chk.completionError(cdef.pos(), ex);
  }
  return null;
}

代码示例来源:origin: konsoletyper/teavm-javac

/** Generate code and emit a class file for a given class
 *  @param env    The attribution environment of the outermost class
 *                containing this class.
 *  @param cdef   The class definition from which code is generated.
 */
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
  try {
    if (gen.genClass(env, cdef) && (errorCount() == 0))
      return writer.writeClass(cdef.sym);
  } catch (ClassWriter.PoolOverflow ex) {
    log.error(cdef.pos(), "limit.pool");
  } catch (ClassWriter.StringOverflow ex) {
    log.error(cdef.pos(), "limit.string.overflow",
         ex.value.substring(0, 20));
  } catch (CompletionFailure ex) {
    chk.completionError(cdef.pos(), ex);
  }
  return null;
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/** Generate code and emit a class file for a given class
 *  @param env    The attribution environment of the outermost class
 *                containing this class.
 *  @param cdef   The class definition from which code is generated.
 */
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
  try {
    if (gen.genClass(env, cdef) && (errorCount() == 0))
      return writer.writeClass(cdef.sym);
  } catch (ClassWriter.PoolOverflow ex) {
    log.error(cdef.pos(), "limit.pool");
  } catch (ClassWriter.StringOverflow ex) {
    log.error(cdef.pos(), "limit.string.overflow",
         ex.value.substring(0, 20));
  } catch (CompletionFailure ex) {
    chk.completionError(cdef.pos(), ex);
  }
  return null;
}

相关文章