public static SuggestedFix getFixForJsError ( JSError error , AbstractCompiler compiler ) { switch ( error . getType ( ) . key ) { case "JSC_REDECLARED_VARIABLE" : return getFixForRedeclaration ( error , compiler ) ; case "JSC_REFERENCE_BEFORE_DECLARE" : return getFixForEarlyReference ( error , compiler ) ; case "JSC_MISSING_SEMICOLON" : return getFixForMissingSemicolon ( error , compiler ) ; case "JSC_REQUIRES_NOT_SORTED" : return getFixForUnsortedRequires ( error , compiler ) ; case "JSC_PROVIDES_NOT_SORTED" : return getFixForUnsortedProvides ( error , compiler ) ; case "JSC_DEBUGGER_STATEMENT_PRESENT" : return removeNode ( error , compiler ) ; case "JSC_USELESS_EMPTY_STATEMENT" : return removeEmptyStatement ( error , compiler ) ; case "JSC_INEXISTENT_PROPERTY" : return getFixForInexistentProperty ( error , compiler ) ; case "JSC_MISSING_CALL_TO_SUPER" : return getFixForMissingSuper ( error , compiler ) ; case "JSC_INVALID_SUPER_CALL_WITH_SUGGESTION" : return getFixForInvalidSuper ( error , compiler ) ; case "JSC_MISSING_REQUIRE_WARNING" : case "JSC_MISSING_REQUIRE_STRICT_WARNING" : return getFixForMissingRequire ( error , compiler ) ; case "JSC_EXTRA_REQUIRE_WARNING" : return getFixForExtraRequire ( error , compiler ) ; case "JSC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME" : case "JSC_JSDOC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME" : case "JSC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME" : // TODO(tbreisacher): Apply this fix for JSC_JSDOC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME. return getFixForReferenceToShortImportByLongName ( error , compiler ) ; case "JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC" : return getFixForRedundantNullabilityModifierJsDoc ( error , compiler ) ; default : return null ; } }
Creates a SuggestedFix for the given error . Note that some errors have multiple fixes so getFixesForJsError should often be used instead of this .