rules_closure icon indicating copy to clipboard operation
rules_closure copied to clipboard

ERROR: Bad --suppress value: JSC_DUPLICATE_NAMESPACE

Open pcj opened this issue 5 years ago • 6 comments

I'm trying to compile a generated javascript protobuf file, and getting this error that I'm trying to suppress:

bazel-out/k8-fastbuild/bin/external/com_github_stackb_grpc_js/js/pb/pb.i.js:2076: ERROR - Duplicate namespace: jspb.Message
goog.provide("jspb.Message");
^
  Codes: JSC_DUPLICATE_NAMESPACE

However, including this suppress code causes a different error ERROR: Bad --suppress value: JSC_DUPLICATE_NAMESPACE:

        suppress = [
            "JSC_DUPLICATE_NAMESPACE",
        ],

Trying to track this down but I suspect it may be related to https://github.com/bazelbuild/rules_closure/pull/347, but it's not so easy to bisect it.

Any ideas?

pcj avatar Apr 15 '19 01:04 pcj

Seems like a valid error if the js/pb/pb.js is providing a jspb.Message in addition to the one coming from the dep to ["@io_bazel_rules_closure//closure/protobuf:jspb"].

Looking at what com_github_stackb_grpc_js does, my rough guess is you are using protoc in a way that embeds jspb runtime into the generated code.

gkdn avatar Apr 16 '19 00:04 gkdn

Regardless of whether the error is valid or not should the compiler not respect the suppress value? It seems like a bug somewhere if it reports the code but then does not recognize it as something that can be suppressed.

I think you are right about the duplicate namespace above. I've removed //js/pb but now struggling with a different error:

bazel-out/k8-fastbuild/bin/external/com_github_stackb_grpc_js/js/grpc/stream/observer/call.i.js:5: ERROR - A file cannot be both a goog.provide'd file and a goog.module.
goog.module("grpc.stream.observer.UnaryCallObserver");
^
  Codes: JSC_MIXED_MODULE_TYPE

But again I cannot suppress JSC_MIXED_MODULE_TYPE for the generated i.js typecheck.

pcj avatar Apr 16 '19 14:04 pcj

Seems like this is similar to #229

Yannic avatar Apr 16 '19 16:04 Yannic

You can only suppress the ones and their aliases in

https://github.com/bazelbuild/rules_closure/blob/50d3dc9e6d27a5577a0f95708466718825d579f4/java/com/google/javascript/jscomp/Diagnostics.java#L75

Feel free to send patches for missing ones that exists in com/google/javascript/jscomp/parsing/ParserConfig.properties

JSC_DUPLICATE_NAMESPACE doesn't seem like in both of the lists. Has the error message suggested that you can suppress it? If not, doesn't seem like there is an issue here.

Aside from all of this, you should not suppress these errors; it doesn't make sense to do so. Consider it more like fatal errors. Seems like the JS you are picking up from the protoc compiler is a bundled JS and not meant to be supplied into Closure Compiler.

gkdn avatar Apr 16 '19 18:04 gkdn

OK, sending a PR. For reference, here are the suppression codes by group:

ambiguousFunctionDecl: JSC_BAD_FUNCTION_DECLARATION: functions can only be declared at top level or immediately within another function in ES5 strict mode
checkDebuggerStatement: JSC_DEBUGGER_STATEMENT_PRESENT: Using the debugger statement can halt your application if the user has a JavaScript debugger running.
checkRegExp: JSC_MALFORMED_REGEXP: Malformed Regular Expression: {0}
checkRegExp: JSC_REGEXP_REFERENCE: References to the global RegExp object prevents optimization of regular expressions.
checkTypes: JSC_ABSTRACT_METHOD_IN_CONCRETE_CLASS: Abstract methods can only appear in abstract classes. Please declare the class as @abstract
checkTypes: JSC_ABSTRACT_METHOD_NOT_IMPLEMENTED: property {0} on abstract class {1} is not implemented by type {2}
checkTypes: JSC_ABSTRACT_SUPER_METHOD_NOT_USABLE: Abstract super method {0} cannot be dereferenced
checkTypes: JSC_BAD_TYPE_FOR_BIT_OPERATION: operator {0} cannot be applied to {1}
checkTypes: JSC_CONFLICTING_EXTENDED_TYPE: {1} cannot extend this type; {0}s can only extend {0}s
checkTypes: JSC_CONFLICTING_IMPLEMENTED_TYPE: {0} cannot implement this type; an interface can only extend, but not implement interfaces
checkTypes: JSC_CONSTRUCTOR_NOT_CALLABLE: Constructor {0} should be called with the "new" keyword
checkTypes: JSC_CONSTRUCTOR_REQUIRED: {0} used without @constructor for {1}
checkTypes: JSC_CTOR_INITIALIZER_NOT_CTOR: Constructor {0} must be initialized at declaration
checkTypes: JSC_ENUM_DUP: enum element {0} already defined
checkTypes: JSC_ES5_CLASS_EXTENDING_ES6_CLASS: ES5 class {0} cannot extend ES6 class {1}
checkTypes: JSC_EXPECTED_THIS_TYPE: "{0}" must be called with a "this" type
checkTypes: JSC_EXTENDS_NON_OBJECT: {0} @extends non-object type {1}
checkTypes: JSC_EXTENDS_WITHOUT_TYPEDEF: @extends used without @constructor or @interface for {0}
checkTypes: JSC_HIDDEN_INTERFACE_PROPERTY_MISMATCH: mismatch of the {0} property on type {1} and the type of the property it overrides from interface {2} original: {3} override: {4}
checkTypes: JSC_HIDDEN_SUPERCLASS_PROPERTY_MISMATCH: mismatch of the {0} property type and the type of the property it overrides from superclass {1}. original: {2}. override: {3}
checkTypes: JSC_IFACE_INITIALIZER_NOT_IFACE: Interface {0} must be initialized at declaration
checkTypes: JSC_ILLEGAL_CLASS_KEY: Illegal key, the class is a {0}
checkTypes: JSC_ILLEGAL_IMPLICIT_CAST: Illegal annotation on {0}. @implicitCast may only be used in externs.
checkTypes: JSC_ILLEGAL_OBJLIT_KEY: Illegal key, the object literal is a {0}
checkTypes: JSC_ILLEGAL_PROPERTY_ACCESS: Cannot do {0} access on a {1}
checkTypes: JSC_ILLEGAL_PROPERTY_CREATION: Cannot add a property to a struct instance after it is constructed. (If you already declared the property, make sure to give it a type.)
checkTypes: JSC_IMPLEMENTS_NON_INTERFACE: can only implement interfaces
checkTypes: JSC_IMPLEMENTS_WITHOUT_CONSTRUCTOR: @implements used without @constructor or @interface for {0}
checkTypes: JSC_IN_USED_WITH_STRUCT: Cannot use the IN operator with structs
checkTypes: JSC_INCOMPATIBLE_EXTENDED_PROPERTY_TYPE: Interface {0} has a property {1} with incompatible types in its super interfaces {2} and {3}
checkTypes: JSC_INEXISTENT_ENUM_ELEMENT: element {0} does not exist on this enum
checkTypes: JSC_INEXISTENT_PARAM: parameter {0} does not appear in {1}''s parameter list
checkTypes: JSC_INSTANTIATE_ABSTRACT_CLASS: cannot instantiate abstract class
checkTypes: JSC_INTERFACE_METHOD_NOT_EMPTY: interface member functions must have an empty body
checkTypes: JSC_INTERFACE_METHOD_NOT_IMPLEMENTED: property {0} on interface {1} is not implemented by type {2}
checkTypes: JSC_INTERFACE_METHOD_OVERRIDE: property {0} is already defined by the {1} extended interface
checkTypes: JSC_INVALID_ASYNC_RETURN_TYPE: The return type of an async function must be a supertype of Promise found: {0}
checkTypes: JSC_INVALID_INTERFACE_MEMBER_DECLARATION: interface members can only be empty property declarations, empty functions{0}
checkTypes: JSC_LENDS_ON_NON_OBJECT: May only lend properties to object types. {0} has type {1}.
checkTypes: JSC_MISSING_EXTENDS_TAG: Missing @extends tag on type {0}
checkTypes: JSC_MULTIPLE_VAR_DEF: declaration of multiple variables with shared type information
checkTypes: JSC_NON_STRINGIFIABLE_OBJECT_KEY: Object type "{0}" contains non-stringifiable key and it may lead to an error. Please use ES6 Map instead or implement your own Map structure.
checkTypes: JSC_NOT_A_CONSTRUCTOR: cannot instantiate non-constructor
checkTypes: JSC_NOT_FUNCTION_TYPE: {0} expressions are not callable
checkTypes: JSC_OPTIONAL_ARG_AT_END: optional arguments must be at the end
checkTypes: JSC_SAME_INTERFACE_MULTIPLE_IMPLEMENTS: Cannot @implement the same interface more than once. Repeated interface: {0}
checkTypes: JSC_TEMPLATE_TRANSFORMATION_ON_CLASS: Template type transformation {0} not allowed on classes or interfaces
checkTypes: JSC_TEMPLATE_TYPE_DUPLICATED: Only one parameter type must be the template type
checkTypes: JSC_TEMPLATE_TYPE_EXPECTED: The template type must be a parameter type
checkTypes: JSC_THIS_TYPE_NON_OBJECT: @this type of a function must be an object. Actual type: {0}
checkTypes: JSC_TYPE_MISMATCH: {0}
checkTypes: JSC_TYPE_PARSE_ERROR: {0}
checkTypes: JSC_TYPE_REDEFINITION: attempted re-definition of type {0} found   : {1} expected: {2}
checkTypes: JSC_UNKNOWN_LENDS: Variable {0} not declared before @lends annotation.
checkTypes: JSC_UNKNOWN_OVERRIDE: property {0} not defined on any superclass of {1}
checkTypes: JSC_UNKNOWN_TYPEOF_VALUE: unknown type: {0}
checkTypes: JSC_UNRECOGNIZED_TYPE_ERROR: {0}
checkTypes: JSC_UNRESOLVED_TYPE: could not resolve the name {0} to a type
checkTypes: JSC_VAR_ARGS_MUST_BE_LAST: variable length argument must be last
checkTypes: JSC_WRONG_ARGUMENT_COUNT: Function {0}: called with {1} argument(s). Function requires at least {2} argument(s){3}.
checkVars: JSC_REFERENCE_BEFORE_DECLARE: Variable referenced before declaration: {0}
closureDepMethodUsageChecks: JSC_CLOSURE_CALL_CANNOT_BE_ALIASED_ERROR: Closure primitive method {0} may not be aliased
closureDepMethodUsageChecks: JSC_INVALID_CLOSURE_CALL_ERROR: Closure primitive methods (goog.provide, goog.require, goog.define, etc) must be called  at file scope.
const: JSC_CONSTANT_REASSIGNED_VALUE_ERROR: constant {0} assigned a value more than once. Original definition at {1}
constantProperty: JSC_CONSTANT_PROPERTY_DELETED: constant property {0} cannot be deleted
constantProperty: JSC_CONSTANT_PROPERTY_REASSIGNED_VALUE: constant property {0} assigned a value more than once
deprecated: JSC_DEPRECATED_CLASS_REASON: Class {0} has been deprecated: {1}
deprecated: JSC_DEPRECATED_CLASS: Class {0} has been deprecated.
deprecated: JSC_DEPRECATED_PROP_REASON: Property {0} of type {1} has been deprecated: {2}
deprecated: JSC_DEPRECATED_PROP: Property {0} of type {1} has been deprecated.
deprecated: JSC_DEPRECATED_VAR_REASON: Variable {0} has been deprecated: {1}
deprecated: JSC_DEPRECATED_VAR: Variable {0} has been deprecated.
es5Strict: JSC_ARGUMENTS_ASSIGNMENT: the "arguments" object cannot be reassigned in strict mode
es5Strict: JSC_ARGUMENTS_CALLEE_FORBIDDEN: "arguments.callee" cannot be used in strict mode
es5Strict: JSC_ARGUMENTS_CALLER_FORBIDDEN: "arguments.caller" cannot be used in strict mode
es5Strict: JSC_ARGUMENTS_DECLARATION: "arguments" cannot be redeclared in strict mode
es5Strict: JSC_DELETE_VARIABLE: variables, functions, and arguments cannot be deleted in strict mode
es5Strict: JSC_DUPLICATE_OBJECT_KEY: Object literal contains illegal duplicate key "{0}", disallowed in strict mode
es5Strict: JSC_DUPLICATE_PARAM: Parse error. {0}
es5Strict: JSC_EVAL_ASSIGNMENT: the "eval" object cannot be reassigned in strict mode
es5Strict: JSC_EVAL_DECLARATION: "eval" cannot be redeclared in strict mode
es5Strict: JSC_FUNCTION_ARGUMENTS_PROP_FORBIDDEN: A function''s "arguments" property cannot be used in strict mode
es5Strict: JSC_FUNCTION_CALLER_FORBIDDEN: A function''s "caller" property cannot be used in strict mode
es5Strict: JSC_INVALID_OCTAL_LITERAL: This style of octal literal is not supported in strict mode.
es5Strict: JSC_USE_OF_WITH: The with statement cannot be used in strict mode.
externsValidation: JSC_NAME_REFERENCE_IN_EXTERNS: accessing name {0} in externs has no effect. Perhaps you forgot to add a var keyword?
externsValidation: JSC_UNDEFINED_EXTERN_VAR_ERROR: name {0} is not defined in the externs.
globalThis: JSC_USED_GLOBAL_THIS: dangerous use of the global this object
googModuleExportNotAStatement: JSC_EXPORT_NOT_A_STATEMENT: Exports should be a statement.
invalidCasts: JSC_INVALID_CAST: invalid cast - must be a subtype or supertype. from: {0}, to  : {1}
lateProvide: JSC_LATE_PROVIDE_ERROR: required "{0}" namespace not provided yet
legacyGoogScopeRequire: JSC_EXTRA_REQUIRE_WARNING: extra require: ''{0}'' is never referenced in this file
legacyGoogScopeRequire: JSC_MISSING_REQUIRE_FOR_GOOG_SCOPE: missing require: ''{0}''
lintChecks: JSC_CLASS_DISALLOWED_JSDOC: @constructor annotations are redundant on classes.
lintChecks: JSC_COMPUTED_PROP_NAME_IN_ENUM: Computed property name used in enum.
lintChecks: JSC_DECLARE_LEGACY_NAMESPACE_IN_NON_MODULE: goog.module.declareLegacyNamespace may only be called in a goog.module.
lintChecks: JSC_DEFAULT_EXPORT: Do not use the default export. There is no way to force consistent naming when imported.
lintChecks: JSC_DUPLICATE_ENUM_VALUE: The value {0} is duplicated in this enum.
lintChecks: JSC_DUPLICATE_IMPORT: The module "{0}" has already been imported at {1}, {2}.
lintChecks: JSC_ENUM_PROP_NOT_CONSTANT: enum key {0} must be in ALL_CAPS.
lintChecks: JSC_EXTERNS_FILES_SHOULD_BE_ANNOTATED: Externs files should be annotated with @externs in the @fileoverview block.
lintChecks: JSC_GOOG_MODULE_IN_NON_MODULE: goog.module() call must be the first statement in a module.
lintChecks: JSC_ILLEGAL_PROTOTYPE_MEMBER: Prototype property {0} should be a primitive, not an Array or Object.
lintChecks: JSC_INCORRECT_PARAM_NAME: Incorrect param name. Are your @param annotations in the wrong order?
lintChecks: JSC_INCORRECT_SHORTNAME_CAPITALIZATION: The capitalization of short name {0} is incorrect; it should be {1}.
lintChecks: JSC_INTERFACE_FUNCTION_NOT_EMPTY: interface functions must have an empty body
lintChecks: JSC_INTERFACE_SHOULD_NOT_TAKE_ARGS: Interface functions should not take any arguments
lintChecks: JSC_JSDOC_MISSING_BRACES_WARNING: {0}
lintChecks: JSC_LET_CLOSURE_IMPORT: Module imports must be constant. Please use ''const'' instead of ''let''.
lintChecks: JSC_MISSING_JSDOC: Function must have JSDoc.
lintChecks: JSC_MISSING_NULLABILITY_MODIFIER_JSDOC: {0} is a reference type with no nullability modifier, which is disallowed by the style guide. Please add a ! to make it explicitly non-nullable, or a ? to make it explicitly nullable.
lintChecks: JSC_MISSING_PARAMETER_JSDOC: Parameter must have JSDoc.
lintChecks: JSC_MISSING_RETURN_JSDOC: Function with non-trivial return must have JSDoc indicating the return type.
lintChecks: JSC_MISSING_SEMICOLON: Missing semicolon
lintChecks: JSC_MIXED_PARAM_JSDOC_STYLES: Functions may not use both @param annotations and inline JSDoc
lintChecks: JSC_MUST_COME_BEFORE_IN_ES6_MODULE: In ES6 modules, {0} should come before {1}.
lintChecks: JSC_MUTATED_EXPORT: The name "{0}" is exported and should not be mutated outside of module initialization. Mutable exports are generally difficult to reason about. You can work around this by exporting getter/setter functions, or an object with mutable properties instead.
lintChecks: JSC_NULL_MISSING_NULLABILITY_MODIFIER_JSDOC: {0} is a reference type with no nullability modifier that is explicitly set to null. Add a ? to make it explicitly nullable.
lintChecks: JSC_OPTIONAL_PARAM_NOT_MARKED_OPTIONAL: Parameter {0} is optional so its type must end with =
lintChecks: JSC_PREFER_BACKTICKS_TO_AT_SIGN_CODE: Use `some_code` instead of '{'@code some_code}.
lintChecks: JSC_PRIMITIVE_OBJECT_DECLARATION: Declaration of {0} object instead of primitive type.
lintChecks: JSC_PRIMITIVE_OBJECT: Explicit creation of a {0} object.
lintChecks: JSC_PROVIDES_NOT_SORTED: goog.provide() statements are not sorted. The correct order is: {0}
lintChecks: JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC: {0} is a non-reference type which is already non-nullable. Please remove the redundant !, which is disallowed by the style guide.
lintChecks: JSC_REQUIRES_NOT_SORTED: goog.require() and goog.requireType() statements are not sorted. The correct order is: {0}
lintChecks: JSC_SHORTHAND_ASSIGNMENT_IN_ENUM: Shorthand assignment used in enum.
lintChecks: JSC_UNUSED_LABEL: Unused label {0}.
lintChecks: JSC_USELESS_BLOCK: Useless block.
lintChecks: JSC_USELESS_EMPTY_STATEMENT: Useless empty statement. Remove semicolon.
lintChecks: JSC_USELESS_USE_STRICT_DIRECTIVE: use strict is unnecessary in goog.module files.
lintChecks: JSC_WRONG_NUMBER_OF_PARAMS: Wrong number of @param annotations
Message constants must be prefixed with MSG_.
messageConventions: JSC_MSG_HAS_NO_DESCRIPTION: Message {0} has no description. Add @desc JsDoc tag.
messageConventions: JSC_MSG_HAS_NO_TEXT: Message value of {0} is just an empty string. Empty messages are forbidden.
messageConventions: JSC_MSG_HAS_NO_VALUE: message node {0} has no value
messageConventions: JSC_MSG_KEY_DUPLICATED: duplicate message variable name found for {0}, initial definition {1}:{2}
messageConventions: JSC_MSG_NOT_INITIALIZED_USING_NEW_SYNTAX: message not initialized using goog.getMsg
messageConventions: JSC_MSG_TREE_MALFORMED: Message parse tree malformed. {0}
misplacedTypeAnnotation: JSC_ARROW_FUNCTION_AS_CONSTRUCTOR: Arrow functions cannot be used as constructors
misplacedTypeAnnotation: JSC_DEFAULT_PARAM_MUST_BE_MARKED_OPTIONAL: Inline JSDoc on default parameters must be marked as optional
misplacedTypeAnnotation: JSC_DISALLOWED_MEMBER_JSDOC: Class level JSDocs (@interface, @extends, etc.) are not allowed on class members
misplacedTypeAnnotation: JSC_INVALID_MODIFIES_ANNOTATION: @modifies may only appear in externs files.
misplacedTypeAnnotation: JSC_INVALID_NO_SIDE_EFFECT_ANNOTATION: @nosideeffects may only appear in externs files.
misplacedTypeAnnotation: JSC_MISPLACED_ANNOTATION: Misplaced {0} annotation. {1}
misplacedTypeAnnotation: JSC_MISPLACED_MSG_ANNOTATION: Misplaced message annotation. @desc, @hidden, and @meaning annotations should only be on message nodes.
missingOverride: JSC_HIDDEN_INTERFACE_PROPERTY: property {0} already defined on interface {1}; use @override to override it
missingOverride: JSC_HIDDEN_SUPERCLASS_PROPERTY: property {0} already defined on superclass {1}; use @override to override it
missingPolyfill: JSC_INSUFFICIENT_OUTPUT_VERSION: Built-in ''{0}'' not supported in output version {1}
missingRequire: JSC_MISSING_REQUIRE_WARNING: missing require: ''{0}''
missingReturn: JSC_MISSING_RETURN_STATEMENT: Missing return statement. Function expected to return {0}.
missingSourcesWarnings: JSC_DUP_VAR_DECLARATION_TYPE_MISMATCH: variable {0} redefined with type {1}, original definition at {2}:{3} with type {4}
missingSourcesWarnings: JSC_DUP_VAR_DECLARATION: variable {0} redefined, original definition at {1}:{2}
missingSourcesWarnings: JSC_FUNCTION_MASKS_VARIABLE: function {0} masks variable (IE bug)
missingSourcesWarnings: JSC_INEXISTENT_PROPERTY_WITH_SUGGESTION: Property {0} never defined on {1}. Did you mean {2}?
missingSourcesWarnings: JSC_INEXISTENT_PROPERTY: Property {0} never defined on {1}
missingSourcesWarnings: JSC_INVALID_DEFINE_INIT_ERROR: illegal initialization of @define variable {0}
missingSourcesWarnings: JSC_MISSING_MODULE_OR_PROVIDE: Required namespace "{0}" never defined.
missingSourcesWarnings: JSC_MISSING_PROVIDE_ERROR: required "{0}" namespace never provided
missingSourcesWarnings: JSC_MISSING_PROVIDE: missing goog.provide(''{0}'')
missingSourcesWarnings: JSC_NAMESPACE_REDEFINED: namespace {0} should not be redefined
missingSourcesWarnings: JSC_POSSIBLE_INEXISTENT_PROPERTY: Property {0} never defined on {1}
missingSourcesWarnings: JSC_REDECLARED_VARIABLE: Redeclared variable: {0}
missingSourcesWarnings: JSC_RESOLVED_TAG_EMPTY: Could not resolve type in {0} tag of {1}
missingSourcesWarnings: JSC_VAR_MULTIPLY_DECLARED_ERROR: Variable {0} declared more than once. First occurrence: {1}
moduleLoad: JSC_COMMONJS_UNKNOWN_REQUIRE_ENSURE_ERROR: Unrecognized require.ensure call: {0}
moduleLoad: JSC_JS_MODULE_LOAD_WARNING: Failed to load module "{0}"
moduleLoad: JSC_MISSING_NAMESPACE_IMPORT: Imported Closure namespace "{0}" never defined.
newCheckTypesAllChecks: JSC_UNUSED: {0}
nonStandardJsDocs: JSC_BAD_JSDOC_ANNOTATION: Parse error. {0}
nonStandardJsDocs: JSC_INVALID_PARAM: Parse error. {0}
nonStandardJsDocs: JSC_JSDOC_IN_BLOCK_COMMENT: Non-JSDoc comment has annotations. Did you mean to start it with /**?
polymer: JSC_POLYMER_DESCRIPTOR_NOT_VALID: The argument to Polymer() is not an obj lit or the Polymer 2 class does not have a static getter named config. Ignoring this definition.
reportUnknownTypes: JSC_UNKNOWN_EXPR_TYPE: could not determine the type of this expression
strictMissingProperties: JSC_STRICT_INEXISTENT_PROPERTY_WITH_SUGGESTION: Property {0} never defined on {1}. Did you mean {2}?
strictMissingProperties: JSC_STRICT_INEXISTENT_PROPERTY: Property {0} never defined on {1}
strictMissingProperties: JSC_STRICT_INEXISTENT_UNION_PROPERTY: Property {0} not defined on all member types of {1}
strictModuleDepCheck: JSC_STRICT_MODULE_DEP_QNAME: cannot reference {2} because of a missing module dependency defined in module {1}, referenced from module {0}
strictModuleDepCheck: JSC_STRICT_MODULE_DEPENDENCY: cannot reference {2} because of a missing module dependency defined in module {1}, referenced from module {0}
strictPrimitiveOperators: JSC_INVALID_OPERAND_TYPE: {0}
suspiciousCode: JSC_COMMONJS_SUSPICIOUS_EXPORTS_ASSIGNMENT: Suspicious re-assignment of "exports" variable. Did you actually intend to export something?
suspiciousCode: JSC_DETERMINISTIC_TEST: condition always evaluates to {2} left : {0}, right: {1}
suspiciousCode: JSC_DUPLICATE_CASE: Duplicate case in a switch statement.
suspiciousCode: JSC_SUSPICIOUS_IN: Use of the "in" keyword on non-object types throws an exception.
suspiciousCode: JSC_SUSPICIOUS_INSTANCEOF_LEFT: "instanceof" with left non-object operand is always false.
suspiciousCode: JSC_SUSPICIOUS_LEFT_OPERAND_OF_LOGICAL_OPERATOR: Left operand of {0} operator is always {1}.
suspiciousCode: JSC_SUSPICIOUS_NAN: Comparison against NaN is always false. Did you mean isNaN()?
suspiciousCode: JSC_SUSPICIOUS_NEGATED_LEFT_OPERAND_OF_IN_OPERATOR: Suspicious negated left operand of in operator.
suspiciousCode: JSC_SUSPICIOUS_SEMICOLON: If this if/for/while really shouldn''t have a body, use '{'}
transitionalSuspiciousCodeWarnings: JSC_FRACTIONAL_BITWISE_OPERAND: Fractional bitwise operand: {0}
transitionalSuspiciousCodeWarnings: JSC_INDEX_OUT_OF_BOUNDS_ERROR: Array index out of bounds: {0}
transitionalSuspiciousCodeWarnings: JSC_NEGATING_A_NON_NUMBER_ERROR: Can''t negate non-numeric value: {0}
undefinedNames: JSC_UNDEFINED_NAME: {0} is never defined
undefinedVars: JSC_UNDEFINED_VARIABLE: variable {0} is undeclared
underscore: JSC_MUST_BE_PRIVATE: Property {0} must be marked @private
underscore: JSC_MUST_HAVE_TRAILING_UNDERSCORE: Private property {0} should end with ''_''
unknownDefines: JSC_UNKNOWN_DEFINE_WARNING: unknown @define variable {0}
unusedLocalVariables: JSC_UNUSED_LOCAL_ASSIGNMENT: Value assigned to local variable {0} is never read
unusedPrivateMembers: JSC_UNUSED_PRIVATE_PROPERTY: Private property {0} is never read
uselessCode: JSC_UNREACHABLE_CODE: unreachable code
uselessCode: JSC_USELESS_CODE: Suspicious code. {0}
visibility: JSC_BAD_PACKAGE_PROPERTY_ACCESS: Access to package-private property {0} of {1} not allowed here.
visibility: JSC_BAD_PRIVATE_GLOBAL_ACCESS: Access to private variable {0} not allowed outside file {1}.
visibility: JSC_BAD_PRIVATE_PROPERTY_ACCESS: Access to private property {0} of {1} not allowed here.
visibility: JSC_BAD_PROTECTED_PROPERTY_ACCESS: Access to protected property {0} of {1} not allowed here.
visibility: JSC_CONVENTION_MISMATCH: Declared access conflicts with access convention.
visibility: JSC_EXTEND_FINAL_CLASS: {0} is not allowed to extend final class {1}.
visibility: JSC_PRIVATE_OVERRIDE: Overriding private property of {0}.
visibility: JSC_VISIBILITY_MISMATCH: Overriding {0} property of {1} with {2} property.
  private static ImmutableMap<DiagnosticType, String> initJsdocSuppressCodes() {
    Map<DiagnosticType, String> builder = new HashMap<>();
    builder.put(StrictModeCheck.USE_OF_WITH, "with");
    for (String suppress : LEGAL_JSDOC_SUPPRESSIONS) {
      if (GROUPS.forName(suppress) == null) {
        continue;
      }
      for (DiagnosticType type : GROUPS.forName(suppress).getTypes()) {
        builder.put(type, suppress);
      }
    }
    if (HACK) {
      StringBuilder sb = new StringBuilder();
      for (Map.Entry<DiagnosticType, String> e : builder.entrySet()) {
        sb.append(String.format("%s: %s\n", e.getValue(), e.getKey()));
      }
      throw new IllegalStateException("diagnostics:\n"+sb);
    }
    return ImmutableMap.copyOf(builder);
  }

pcj avatar Apr 17 '19 00:04 pcj

And FWIW, I realize these are bizarre things to try and suppress. However, they occur within the i.js file that is generated by the JsChecker as follows:

    // write .i.js type summary for this library
    if (!outputIjsFile.isEmpty()) {
      Files.write(Paths.get(outputIjsFile), compiler.toSource().getBytes(UTF_8));
    }

I'm not sure, but it seems to me that compiler.toSource() is generating invalid output under various conditions, not fully taking into account the ordering of source files or slightly transforming output in some way.

pcj avatar Apr 17 '19 00:04 pcj