com.google.javascript.jscomp.CheckLevel Java Examples

The following examples show how to use com.google.javascript.jscomp.CheckLevel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Nopol2017_0029_s.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    MemoizedScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #2
Source File: Closure_66_TypeCheck_t.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    ScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #3
Source File: Closure_2_TypeCheck_t.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    MemoizedScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #4
Source File: TypeCheck.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    MemoizedScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #5
Source File: Closure_66_TypeCheck_s.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    ScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #6
Source File: Closure_11_TypeCheck_s.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    ScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #7
Source File: Closure_69_TypeCheck_s.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    ScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #8
Source File: Closure_2_TypeCheck_s.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    MemoizedScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #9
Source File: Closure_11_TypeCheck_t.java    From coming with MIT License 6 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    Scope topScope,
    ScopeCreator scopeCreator,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this.compiler = compiler;
  this.validator = compiler.getTypeValidator();
  this.reverseInterpreter = reverseInterpreter;
  this.typeRegistry = typeRegistry;
  this.topScope = topScope;
  this.scopeCreator = scopeCreator;
  this.reportMissingOverride = reportMissingOverride;
  this.reportUnknownTypes = reportUnknownTypes;
  this.inferJSDocInfo = new InferJSDocInfo(compiler);
}
 
Example #10
Source File: ClutzErrorManager.java    From clutz with MIT License 6 votes vote down vote up
@Override
public void report(CheckLevel level, JSError error) {
  // Ignore warnings in non-debug mode.
  if (!debug && level == CheckLevel.WARNING) return;

  if (reportClutzMissingTypes
      && error.getDescription().contains("Bad type annotation. Unknown type")) {
    // Prepend an error that hints at missing externs/dependencies.
    reportClutzMissingTypes = false;
    // Leave out the location on purpose, the specific places of missing types are reported from
    // the original message; without a location this error sorts first, so that it is seen first.
    this.report(CheckLevel.ERROR, JSError.make(DeclarationGenerator.CLUTZ_MISSING_TYPES));
    // Fall through, still report the actual error below.
  }
  super.report(level, error);
}
 
Example #11
Source File: Nopol2017_0029_s.java    From coming with MIT License 5 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this(compiler, reverseInterpreter, typeRegistry, null, null,
      reportMissingOverride, reportUnknownTypes);
}
 
Example #12
Source File: DossierCommandLineRunner.java    From js-dossier with Apache License 2.0 5 votes vote down vote up
@Inject
DossierCommandLineRunner(
    @StrictMode boolean strictMode,
    @Stdout PrintStream stdout,
    @Stderr PrintStream stderr,
    @Input FileSystem inputFileSystem,
    @Input ImmutableSet<Path> sources,
    @Externs ImmutableSet<Path> externs,
    Provider<DossierCompiler> compilerProvider,
    Provider<CompilerOptions> optionsProvider) {
  super(new String[0], stdout, stderr);
  this.inputFileSystem = inputFileSystem;
  this.compilerProvider = compilerProvider;
  this.optionsProvider = optionsProvider;

  getCommandLineConfig()
      .setWarningGuards(
          CHECKS
              .stream()
              .map(
                  c ->
                      new HiddenFlagEntry<>(
                          strictMode ? CheckLevel.ERROR : CheckLevel.WARNING, c))
              .collect(toList()))
      .setCodingConvention(new ClosureCodingConvention())
      .setMixedJsSources(
          sources
              .stream()
              .map(s -> new HiddenFlagEntry<>(JsSourceType.JS, s.toString()))
              .collect(toList()))
      .setExterns(externs.stream().map(Path::toString).collect(toList()));
}
 
Example #13
Source File: GentsErrorManager.java    From clutz with MIT License 5 votes vote down vote up
@Override
public void report(CheckLevel level, JSError error) {
  // Ignore warnings in non-debug mode.
  if (!debug && level == CheckLevel.WARNING) {
    return;
  }
  super.report(level, error);
}
 
Example #14
Source File: Closure_2_TypeCheck_t.java    From coming with MIT License 5 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this(compiler, reverseInterpreter, typeRegistry, null, null,
      reportMissingOverride, reportUnknownTypes);
}
 
Example #15
Source File: LoggerErrorManager.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void println(CheckLevel level, JSError error) {
  switch (level) {
    case ERROR:
      logger.severe(error.format(level, formatter));
      break;
    case WARNING:
      logger.warning(error.format(level, formatter));
      break;
    case OFF:
      break;
  }
}
 
Example #16
Source File: ClosureJsInteropGenerator.java    From jsinterop-generator with Apache License 2.0 5 votes vote down vote up
private CompilerOptions createCompilerOptions() {
  CompilerOptions options = new CompilerOptions();

  options.setLanguageOut(ECMASCRIPT5);
  options.setChecksOnly(true);
  options.setStrictModeInput(true);
  options.setCheckTypes(true);
  options.setPreserveDetailedSourceInfo(true);
  options.setWarningLevel(DiagnosticGroups.UNRECOGNIZED_TYPE_ERROR, CheckLevel.ERROR);

  return options;
}
 
Example #17
Source File: BasicErrorManager.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void report(CheckLevel level, JSError error) {
  if (messages.add(new ErrorWithLevel(error, level))) {
    if (level == CheckLevel.ERROR) {
      errorCount++;
    } else if (level == CheckLevel.WARNING) {
      warningCount++;
    }
  }
}
 
Example #18
Source File: AbstractMessageFormatter.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
String getLevelName(CheckLevel level) {
  switch (level) {
    case ERROR: return maybeColorize("ERROR", Color.ERROR);
    case WARNING: return maybeColorize("WARNING", Color.WARNING);
    default: return level.toString();
  }
}
 
Example #19
Source File: AntErrorManager.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void println(CheckLevel level, JSError error) {
  switch (level) {
    case ERROR:
      this.task.log(error.format(level, this.formatter), Project.MSG_ERR);
      break;
    case WARNING:
      this.task.log(error.format(level, this.formatter), Project.MSG_WARN);
      break;
    case OFF:
      break;
  }
}
 
Example #20
Source File: DevirtualizePrototypeMethodsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testRewritePrototypeMethods2() throws Exception {
  // type checking on
  enableTypeCheck(CheckLevel.ERROR);
  checkTypes(RewritePrototypeMethodTestInput.INPUT,
             RewritePrototypeMethodTestInput.EXPECTED,
             RewritePrototypeMethodTestInput.EXPECTED_TYPE_CHECKING_ON);
}
 
Example #21
Source File: Closure_66_TypeCheck_s.java    From coming with MIT License 5 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this(compiler, reverseInterpreter, typeRegistry, null, null,
      reportMissingOverride, reportUnknownTypes);
}
 
Example #22
Source File: Nopol2017_0051_t.java    From coming with MIT License 5 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this(compiler, reverseInterpreter, typeRegistry, null, null,
      reportMissingOverride, reportUnknownTypes);
}
 
Example #23
Source File: Closure_69_TypeCheck_t.java    From coming with MIT License 5 votes vote down vote up
public TypeCheck(AbstractCompiler compiler,
    ReverseAbstractInterpreter reverseInterpreter,
    JSTypeRegistry typeRegistry,
    CheckLevel reportMissingOverride,
    CheckLevel reportUnknownTypes) {
  this(compiler, reverseInterpreter, typeRegistry, null, null,
      reportMissingOverride, reportUnknownTypes);
}
 
Example #24
Source File: BasicErrorManagerTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
private ErrorWithLevel warning(JSError e) {
  return new ErrorWithLevel(e, CheckLevel.WARNING);
}
 
Example #25
Source File: jMutRepair_0032_s.java    From coming with MIT License 4 votes vote down vote up
CheckSideEffects(AbstractCompiler compiler, CheckLevel level,
    boolean protectSideEffectFreeCode) {
  this.compiler = compiler;
  this.level = level;
  this.protectSideEffectFreeCode = protectSideEffectFreeCode;
}
 
Example #26
Source File: DepsGenerator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
private void reportNoDepsInDepsFile(String filePath) {
  errorManager.report(CheckLevel.WARNING,
      JSError.make(filePath, -1, -1, NO_DEPS_WARNING));
}
 
Example #27
Source File: WhitelistWarningsGuard.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void report(CheckLevel level, JSError error) {
  warnings.add(error);
}
 
Example #28
Source File: DiagnosticGroupWarningsGuard.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public DiagnosticGroupWarningsGuard(
    DiagnosticGroup group, CheckLevel level) {
  this.group = group;
  this.level = level;
}
 
Example #29
Source File: BasicErrorManagerTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
private ErrorWithLevel error(JSError e) {
  return new ErrorWithLevel(e, CheckLevel.ERROR);
}
 
Example #30
Source File: jMutRepair_0022_t.java    From coming with MIT License 4 votes vote down vote up
CheckSideEffects(AbstractCompiler compiler, CheckLevel level,
    boolean protectSideEffectFreeCode) {
  this.compiler = compiler;
  this.level = level;
  this.protectSideEffectFreeCode = protectSideEffectFreeCode;
}