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

Java MessageFormatter类代码示例

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

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



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

示例1: createCompiler

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
private Compiler createCompiler(CompilerOptions options) {
  Compiler compiler = new Compiler();
  MessageFormatter formatter =
      options.errorFormat.toFormatter(compiler, false);
  AntErrorManager errorManager = new AntErrorManager(formatter, this);
  compiler.setErrorManager(errorManager);
  return compiler;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:CompileTask.java


示例2: generateReport

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
@Override
public void generateReport() {
  MessageFormatter formatter = new LightweightMessageFormatter(
      Preconditions.checkNotNull(sourceExcerptProvider));
  for (JSError error : errors) {
    log.error(error.format(CheckLevel.ERROR, formatter));
  }
  for (JSError warning : warnings) {
    log.warn(warning.format(CheckLevel.WARNING, formatter));
  }
}
 
开发者ID:mikesamuel,项目名称:closure-maven-plugin,代码行数:12,代码来源:MavenLogJSErrorManager.java


示例3: build

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
public static String build(Task task, List<File> inputs) {
  List<SourceFile> externs;
  try {
    externs = CommandLineRunner.getDefaultExterns();
  } catch (IOException e) {
    throw new BuildException(e);
  }

  List<SourceFile> jsInputs = new ArrayList<SourceFile>();
  for (File f : inputs) {
    jsInputs.add(SourceFile.fromFile(f));
  }

  CompilerOptions options = new CompilerOptions();
  CompilationLevel.ADVANCED_OPTIMIZATIONS
      .setOptionsForCompilationLevel(options);
  WarningLevel.VERBOSE.setOptionsForWarningLevel(options);
  for (DiagnosticGroup dg : diagnosticGroups) {
    options.setWarningLevel(dg, CheckLevel.ERROR);
  }

  options.setCodingConvention(new GoogleCodingConvention());

  Compiler compiler = new Compiler();
  MessageFormatter formatter =
      options.errorFormat.toFormatter(compiler, false);
  AntErrorManager errorManager = new AntErrorManager(formatter, task);
  compiler.setErrorManager(errorManager);

  Result r = compiler.compile(externs, jsInputs, options);
  if (!r.success) {
    return null;
  }

  String wrapped = "(function(){" + compiler.toSource() + "})();\n";
  return wrapped;
}
 
开发者ID:google,项目名称:caja,代码行数:38,代码来源:ClosureCompiler.java


示例4: createCompiler

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
private Compiler createCompiler(CompilerOptions options) {
  Compiler compiler = new Compiler();
  MessageFormatter formatter =
      options.getErrorFormat().toFormatter(compiler, false);
  AntErrorManager errorManager = new AntErrorManager(formatter, this);
  compiler.setErrorManager(errorManager);
  return compiler;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:9,代码来源:CompileTask.java


示例5: format

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
private static String format(SourceExcerptProvider source, JSError[] errors, JSError[] warnings) {
  StringBuilder sb = new StringBuilder().append("Transpilation failed:\n");
  MessageFormatter formatter =
      source != null
          ? ErrorFormat.SINGLELINE.toFormatter(source, false)
          : ErrorFormat.SOURCELESS.toFormatter(source, false);
  for (JSError error : errors) {
    sb.append("\n").append(formatter.formatError(error));
  }
  for (JSError warning : warnings) {
    sb.append("\n").append(formatter.formatError(warning));
  }
  return sb.toString();
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:15,代码来源:TranspilationException.java


示例6: transform

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
@Override
public Source transform(Source input) {
  CompileResult result = compilerSupplier.compile(input.path(), input.code());
  if (result.errors.length > 0) {
    // TODO(sdh): how to handle this?  Currently we throw an ISE with the message,
    // but this may not be the most appropriate option.  It might make sense to
    // add console.log() statements to any JS that comes out, particularly for
    // warnings.
    MessageFormatter formatter = ErrorFormat.SOURCELESS.toFormatter(null, false);
    StringBuilder message =
        new StringBuilder().append(getTranformationName()).append(" failed.\n");
    for (JSError error : result.errors) {
      message.append(formatter.formatError(error));
    }
    throw new IllegalStateException(message.toString());
  }
  if (!result.transformed) {
    return input;
  }
  Source.Builder builder = input.toBuilder()
      .setCode(result.source)
      .setSourceMap(result.sourceMap);
  if (getRuntime().isPresent()) {
      builder.addRuntime(compilerSupplier.runtime(getRuntime().get()));
  }
  return builder.build();
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:28,代码来源:CompilerBasedTransformer.java


示例7: AntErrorManager

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
public AntErrorManager(MessageFormatter formatter, Task task) {
  this.formatter = formatter;
  this.task = task;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:5,代码来源:AntErrorManager.java


示例8: GentsErrorManager

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
GentsErrorManager(PrintStream stream, MessageFormatter formatter, boolean debug) {
  super(formatter, stream);
  this.debug = debug;
}
 
开发者ID:angular,项目名称:clutz,代码行数:5,代码来源:GentsErrorManager.java


示例9: ClutzErrorManager

import com.google.javascript.jscomp.MessageFormatter; //导入依赖的package包/类
ClutzErrorManager(PrintStream stream, MessageFormatter formatter, boolean debug) {
  super(formatter, stream);
  this.debug = debug;
}
 
开发者ID:angular,项目名称:clutz,代码行数:5,代码来源:ClutzErrorManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IntSet类代码示例发布时间:2022-05-22
下一篇:
Java XRInternalSurfaceData类代码示例发布时间: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