Class CompilerOptions

  • All Implemented Interfaces:
    java.io.Serializable

    public class CompilerOptions
    extends java.lang.Object
    implements java.io.Serializable
    Compiler options
    See Also:
    Serialized Form
    • Field Detail

      • messageBundle

        public @Nullable MessageBundle messageBundle
        Returns localized replacement for MSG_* variables
      • checkSymbols

        public boolean checkSymbols
        Checks that all symbols are defined
      • checkSuspiciousCode

        public boolean checkSuspiciousCode
        Checks for suspicious statements that have no effect
      • checkTypes

        public boolean checkTypes
        Checks types on expressions
      • foldConstants

        public boolean foldConstants
        Folds constants (e.g. (2 + 3) to 5)
      • deadAssignmentElimination

        public boolean deadAssignmentElimination
        Remove assignments to values that can not be referenced
      • inlineConstantVars

        public boolean inlineConstantVars
        Inlines constants (symbols that are all CAPS)
      • coalesceVariableNames

        public boolean coalesceVariableNames
        Merge two variables together as one.
      • inlineVariables

        public boolean inlineVariables
        Inlines variables
      • flowSensitiveInlineVariables

        public boolean flowSensitiveInlineVariables
      • smartNameRemoval

        public boolean smartNameRemoval
        Removes code associated with unused global names
      • removeDeadCode

        public boolean removeDeadCode
        Removes code that will never execute
      • removeUnusedPrototypeProperties

        public boolean removeUnusedPrototypeProperties
        Removes unused member prototypes
      • removeUnusedClassProperties

        public boolean removeUnusedClassProperties
        Removes unused member properties
      • removeUnusedVars

        public boolean removeUnusedVars
        Removes unused variables
      • removeUnusedLocalVars

        public boolean removeUnusedLocalVars
        Removes unused variables in local scope.
      • collapseVariableDeclarations

        public boolean collapseVariableDeclarations
        Collapses multiple variable declarations into one
      • collapseAnonymousFunctions

        public boolean collapseAnonymousFunctions
        Collapses anonymous function declarations into named function declarations
      • convertToDottedProperties

        public boolean convertToDottedProperties
        Converts quoted property accesses to dot syntax (a['b'] → a.b)
      • rewriteFunctionExpressions

        public boolean rewriteFunctionExpressions
        Reduces the size of common function expressions.
      • optimizeCalls

        public boolean optimizeCalls
        Remove unused function arguments, remove unused return values, and inlines constant parameters.
      • optimizeArgumentsArray

        public boolean optimizeArgumentsArray
        Provide formal names for elements of arguments array.
      • labelRenaming

        public boolean labelRenaming
        Controls label renaming.
      • reserveRawExports

        public boolean reserveRawExports
        Reserve property names on the global this object.
      • generatePseudoNames

        public boolean generatePseudoNames
        Generate pseudo names for variables and properties for debugging purposes.
      • renamePrefix

        public @Nullable java.lang.String renamePrefix
        Specifies a prefix for all globals
      • renamePrefixNamespace

        public java.lang.String renamePrefixNamespace
        Specifies the name of an object that will be used to store all non-extern globals.
      • devirtualizeMethods

        public boolean devirtualizeMethods
        Devirtualize prototype method by rewriting them to be static calls that take the this pointer as their first argument
      • computeFunctionSideEffects

        public boolean computeFunctionSideEffects
        Use @nosideeffects annotations, function bodies and name graph to determine if calls have side effects.
      • exportTestFunctions

        public boolean exportTestFunctions
        Whether to export test functions.
      • syntheticBlockStartMarker

        public @Nullable java.lang.String syntheticBlockStartMarker
      • syntheticBlockEndMarker

        public @Nullable java.lang.String syntheticBlockEndMarker
      • locale

        public @Nullable java.lang.String locale
        Compiling locale
      • markAsCompiled

        public boolean markAsCompiled
        Sets the special "COMPILED" value to true
      • closurePass

        public boolean closurePass
        Processes goog.provide() and goog.require() calls
      • gatherCssNames

        public boolean gatherCssNames
        Gather CSS names (requires closurePass)
      • rewriteGlobalDeclarationsForTryCatchWrapping

        public boolean rewriteGlobalDeclarationsForTryCatchWrapping
        Move top-level function declarations to the top
      • generateExports

        public boolean generateExports
      • cssRenamingMap

        public @Nullable CssRenamingMap cssRenamingMap
        Map used in the renaming of CSS class names.
      • preserveTypeAnnotations

        public boolean preserveTypeAnnotations
        Do not strip closure-style type annotations from code.
      • gentsMode

        public boolean gentsMode
        To distinguish between gents and non-gents mode so that we can turn off checking the sanity of the source location of comments, and also provide a different mode for comment printing between those two.
      • lineBreak

        public boolean lineBreak
        Line break the output a bit more aggressively
      • preferLineBreakAtEndOfFile

        public boolean preferLineBreakAtEndOfFile
        Prefer line breaks at end of file
      • printInputDelimiter

        public boolean printInputDelimiter
        Prints a separator comment before each JS script
      • inputDelimiter

        public java.lang.String inputDelimiter
        The string to use as the separator for printInputDelimiter
      • sourceMapDetailLevel

        public SourceMap.DetailLevel sourceMapDetailLevel
        The detail level for the generated source map.
      • sourceMapFormat

        public SourceMap.Format sourceMapFormat
        The source map file format
      • parenthesizeFunctionsInChunks

        public java.util.List<java.lang.String> parenthesizeFunctionsInChunks
    • Constructor Detail

      • CompilerOptions

        public CompilerOptions()
        Initializes compiler options. All options are disabled by default.

        Command-line frontends to the compiler should set these properties like a builder.

    • Method Detail

      • getAngularPropertyReservedFirstChars

        public static com.google.common.collect.ImmutableSet<java.lang.Character> getAngularPropertyReservedFirstChars()
      • shouldRunCrossChunkCodeMotion

        public boolean shouldRunCrossChunkCodeMotion()
      • shouldRunCrossChunkMethodMotion

        public boolean shouldRunCrossChunkMethodMotion()
      • getSourceMapOutputPath

        public java.lang.String getSourceMapOutputPath()
      • shouldGatherSourceMapInfo

        public boolean shouldGatherSourceMapInfo()
      • setAlwaysGatherSourceMapInfo

        public void setAlwaysGatherSourceMapInfo​(boolean shouldAlwaysGatherSourceMapInfo)
      • getBrowserFeaturesetYear

        public int getBrowserFeaturesetYear()
      • setBrowserFeaturesetYear

        public void setBrowserFeaturesetYear​(int year)
      • setInstrumentForCoverageOnly

        public void setInstrumentForCoverageOnly​(boolean instrumentForCoverageOnly)
      • getInstrumentForCoverageOnly

        public boolean getInstrumentForCoverageOnly()
      • setTypedAstOutputFile

        public void setTypedAstOutputFile​(@Nullable java.nio.file.Path file)
        Sets file to output in-progress TypedAST format to. DO NOT USE!
      • setSkipTranspilationAndCrash

        @Deprecated
        public void setSkipTranspilationAndCrash​(boolean value)
        Deprecated.
      • setInputSourceMaps

        public void setInputSourceMaps​(com.google.common.collect.ImmutableMap<java.lang.String,​SourceMapInput> inputSourceMaps)
        Sets the input sourcemap files, indexed by the JS files they refer to.
        Parameters:
        inputSourceMaps - the collection of input sourcemap files
      • setInferConst

        public void setInferConst​(boolean value)
      • setCheckMissingOverrideTypes

        public void setCheckMissingOverrideTypes​(boolean value)
        This option runs JSCompiler in a fix mode to fix missing @param and @return types in override methods. It is intended for use temporarily and only in developer mode. TODO(b/178107524): Delete this option.
      • isCheckingMissingOverrideTypes

        public boolean isCheckingMissingOverrideTypes()
      • shouldGenerateTypedExterns

        public boolean shouldGenerateTypedExterns()
      • shouldRunTypeSummaryChecksLate

        public boolean shouldRunTypeSummaryChecksLate()
      • setCheckGlobalThisLevel

        @Deprecated
        public void setCheckGlobalThisLevel​(CheckLevel level)
        Deprecated.
        Deprecated. Please use setWarningLevel(DiagnosticGroups.GLOBAL_THIS, level) instead.
      • setNumParallelThreads

        public void setNumParallelThreads​(int parallelism)
        Sets the level of parallelism for compilation passes that can exploit multi-threading.

        Some compiler passes may take advantage of multi-threading, for example, parsing inputs. This sets the level of parallelism. The compiler will not start more than this number of threads.

        Parameters:
        parallelism - up to this number of parallel threads may be created.
      • setRenamePrefixNamespaceAssumeCrossChunkNames

        public void setRenamePrefixNamespaceAssumeCrossChunkNames​(boolean assume)
        Useful for tests to avoid having to declare two chunks
      • shouldCollapseProperties

        @Deprecated
        public boolean shouldCollapseProperties()
        Deprecated.
        use getPropertyCollapseLevel
        Flattens multi-level property names (e.g. a$b = x)
      • setCollapseObjectLiterals

        public void setCollapseObjectLiterals​(boolean enabled)
      • getCollapseObjectLiterals

        public boolean getCollapseObjectLiterals()
      • setNameGenerator

        public void setNameGenerator​(NameGenerator nameGenerator)
      • setReplaceMessagesWithChromeI18n

        public void setReplaceMessagesWithChromeI18n​(boolean replaceMessagesWithChromeI18n,
                                                     java.lang.String tcProjectId)
      • shouldRunReplaceMessagesForChrome

        public boolean shouldRunReplaceMessagesForChrome()
        Should we run the pass that does replacement of the chrome-specific `chrome.i18n.getMessage()` translatable message definitions?

        This form of l10n is incompatible with our standard `goog.getMsg()` messages.

      • setAssumeForwardDeclaredForMissingTypes

        public void setAssumeForwardDeclaredForMissingTypes​(boolean assumeForwardDeclaredForMissingTypes)
        If true, considers all missing types to be forward declared (useful for partial compilation).
      • setPreferSingleQuotes

        public void setPreferSingleQuotes​(boolean enabled)
        Normally, when there are an equal number of single and double quotes in a string, the compiler will use double quotes. Set this to true to prefer single quotes.
      • setTrustedStrings

        public void setTrustedStrings​(boolean yes)
        Some people want to put arbitrary user input into strings, which are then run through the compiler. These scripts are then put into HTML. By default, we assume strings are untrusted. If the compiler is run from the command-line, we assume that strings are trusted.
      • setPrintSourceAfterEachPass

        public void setPrintSourceAfterEachPass​(boolean printSource)
      • setFilesToPrintAfterEachPassRegexList

        public void setFilesToPrintAfterEachPassRegexList​(java.util.List<java.lang.String> filePathRegexList)
      • setChunksToPrintAfterEachPassRegexList

        public void setChunksToPrintAfterEachPassRegexList​(java.util.List<java.lang.String> chunkPathRegexList)
      • setQnameUsesToPrintAfterEachPassList

        public void setQnameUsesToPrintAfterEachPassList​(java.util.List<java.lang.String> qnameRegexList)
      • setTracerOutput

        public void setTracerOutput​(java.nio.file.Path out)
      • setProtectHiddenSideEffects

        public void setProtectHiddenSideEffects​(boolean enable)
        When enabled, assume that apparently side-effect free code is meaningful.
      • shouldProtectHiddenSideEffects

        public boolean shouldProtectHiddenSideEffects()
        Whether or not the compiler should wrap apparently side-effect free code to prevent it from being removed
      • setAssumeGettersArePure

        public void setAssumeGettersArePure​(boolean x)
      • getAssumeGettersArePure

        public boolean getAssumeGettersArePure()
      • setAssumeStaticInheritanceIsNotUsed

        public void setAssumeStaticInheritanceIsNotUsed​(boolean x)
      • getAssumeStaticInheritanceIsNotUsed

        public boolean getAssumeStaticInheritanceIsNotUsed()
      • setConformanceRemoveRegexFromPath

        public void setConformanceRemoveRegexFromPath​(com.google.common.base.Optional<java.util.regex.Pattern> pattern)
      • getConformanceRemoveRegexFromPath

        public com.google.common.base.Optional<java.util.regex.Pattern> getConformanceRemoveRegexFromPath()
      • setWrapGoogModulesForWhitespaceOnly

        public void setWrapGoogModulesForWhitespaceOnly​(boolean enable)
      • setBadRewriteModulesBeforeTypecheckingThatWeWantToGetRidOf

        public void setBadRewriteModulesBeforeTypecheckingThatWeWantToGetRidOf​(boolean b)
        Whether to enable the bad module rewriting before typechecking that we want to get rid of
      • setEnableModuleRewriting

        public void setEnableModuleRewriting​(boolean enable)
        Experimental option to disable all Closure and ES module and goog.provide rewriting

        Use at your own risk - disabling module rewriting is not fully tested yet.

      • setPrintConfig

        public void setPrintConfig​(boolean printConfig)
        Should the compiler print its configuration options to stderr when they are initialized?

        Default false.

      • setAllowDynamicImport

        public void setAllowDynamicImport​(boolean value)
        Whether to enable support for dynamic import expressions
      • getDynamicImportAlias

        public java.lang.String getDynamicImportAlias()
        Set the alias name for dynamic import expressions
      • setDynamicImportAlias

        public void setDynamicImportAlias​(java.lang.String value)
        Set the alias name for dynamic import expressions
      • isRemoveUnusedClassProperties

        public boolean isRemoveUnusedClassProperties()
        Returns:
        Whether to attempt to remove unused class properties
      • setRemoveUnusedClassProperties

        public void setRemoveUnusedClassProperties​(boolean removeUnusedClassProperties)
        Parameters:
        removeUnusedClassProperties - Whether to attempt to remove unused class properties
      • getDefineReplacements

        public com.google.common.collect.ImmutableMap<java.lang.String,​Node> getDefineReplacements()
        Returns the map of define replacements.
      • setDefineToBooleanLiteral

        public void setDefineToBooleanLiteral​(java.lang.String defineName,
                                              boolean value)
        Sets the value of the @define variable in JS to a boolean literal.
      • setDefineToStringLiteral

        public void setDefineToStringLiteral​(java.lang.String defineName,
                                             java.lang.String value)
        Sets the value of the @define variable in JS to a String literal.
      • setDefineToNumberLiteral

        public void setDefineToNumberLiteral​(java.lang.String defineName,
                                             int value)
        Sets the value of the @define variable in JS to a number literal.
      • setDefineToDoubleLiteral

        public void setDefineToDoubleLiteral​(java.lang.String defineName,
                                             double value)
        Sets the value of the @define variable in JS to a number literal.
      • skipAllCompilerPasses

        public void skipAllCompilerPasses()
        Skip all possible passes, to make the compiler as fast as possible.
      • setWarningLevel

        public void setWarningLevel​(DiagnosticGroup type,
                                    CheckLevel level)
        Configure the given type of warning to the given level.
      • resetWarningsGuard

        public void resetWarningsGuard()
        Reset the warnings guard.
      • addWarningsGuard

        public void addWarningsGuard​(WarningsGuard guard)
        Add a guard to the set of warnings guards.
      • setRenamingPolicy

        public void setRenamingPolicy​(VariableRenamingPolicy newVariablePolicy,
                                      PropertyRenamingPolicy newPropertyPolicy)
        Sets the variable and property renaming policies for the compiler, in a way that clears warnings about the renaming policy being uninitialized from flags.
      • setReplaceIdGenerators

        public void setReplaceIdGenerators​(boolean replaceIdGenerators)
        Parameters:
        replaceIdGenerators - the replaceIdGenerators to set
      • setIdGenerators

        public void setIdGenerators​(java.util.Set<java.lang.String> idGenerators)
        Sets the id generators to replace.
      • setIdGenerators

        public void setIdGenerators​(java.util.Map<java.lang.String,​RenamingMap> idGenerators)
        Sets the id generators to replace.
      • setIdGeneratorsMap

        public void setIdGeneratorsMap​(java.lang.String previousMappings)
        A previous map of ids (serialized to a string by a previous compile). This will be used as a hint during the ReplaceIdGenerators pass, which will attempt to reuse the same ids.
      • setXidHashFunction

        public void setXidHashFunction​(Xid.HashFunction xidHashFunction)
        Sets the hash function to use for Xid
      • setInlineFunctions

        @InlineMe(replacement="this.setInlineFunctions(inlineFunctions ? Reach.ALL : Reach.NONE)",
                  imports="com.google.javascript.jscomp.CompilerOptions.Reach")
        @Deprecated
        public final void setInlineFunctions​(boolean inlineFunctions)
        Deprecated.
      • setInlineFunctions

        public void setInlineFunctions​(CompilerOptions.Reach reach)
        Set the function inlining policy for the compiler.
      • getInlineFunctionsLevel

        public CompilerOptions.Reach getInlineFunctionsLevel()
        Get the function inlining policy for the compiler.
      • setMaxFunctionSizeAfterInlining

        public void setMaxFunctionSizeAfterInlining​(int funAstSize)
      • setInlineVariables

        public void setInlineVariables​(boolean inlineVariables)
      • setInlineVariables

        public void setInlineVariables​(CompilerOptions.Reach reach)
        Set the variable inlining policy for the compiler.
      • setInlineProperties

        public void setInlineProperties​(boolean enable)
        Set the function inlining policy for the compiler.
      • shouldInlineProperties

        public boolean shouldInlineProperties()
      • setRemoveUnusedVariables

        public void setRemoveUnusedVariables​(CompilerOptions.Reach reach)
        Set the variable removal policy for the compiler.
      • setReplaceStringsConfiguration

        public void setReplaceStringsConfiguration​(java.lang.String placeholderToken,
                                                   java.util.List<java.lang.String> functionDescriptors)
        Sets the functions whose debug strings to replace.
      • setRemoveAbstractMethods

        public void setRemoveAbstractMethods​(boolean remove)
      • setRemoveClosureAsserts

        public void setRemoveClosureAsserts​(boolean remove)
      • setRemoveJ2clAsserts

        public void setRemoveJ2clAsserts​(boolean remove)
      • setColorizeErrorOutput

        public void setColorizeErrorOutput​(boolean colorizeErrorOutput)
      • shouldColorizeErrorOutput

        public boolean shouldColorizeErrorOutput()
      • setChecksOnly

        public void setChecksOnly​(boolean checksOnly)
      • setGenerateExports

        public void setGenerateExports​(boolean generateExports)
      • setExportLocalPropertyDefinitions

        public void setExportLocalPropertyDefinitions​(boolean export)
      • shouldExportLocalPropertyDefinitions

        public boolean shouldExportLocalPropertyDefinitions()
      • setAngularPass

        public void setAngularPass​(boolean angularPass)
      • setPolymerVersion

        public void setPolymerVersion​(java.lang.Integer polymerVersion)
      • setPolymerExportPolicy

        public void setPolymerExportPolicy​(PolymerExportPolicy polymerExportPolicy)
      • setChromePass

        public void setChromePass​(boolean chromePass)
      • isChromePassEnabled

        public boolean isChromePassEnabled()
      • setJ2clMinifierEnabled

        public void setJ2clMinifierEnabled​(boolean enabled)
      • setJ2clMinifierPruningManifest

        public void setJ2clMinifierPruningManifest​(java.lang.String j2clMinifierPruningManifest)
      • setCodingConvention

        public void setCodingConvention​(CodingConvention codingConvention)
      • setDependencyOptions

        public void setDependencyOptions​(DependencyOptions dependencyOptions)
        Sets the dependency management options.
      • setSummaryDetailLevel

        public void setSummaryDetailLevel​(int summaryDetailLevel)
        Controls how detailed the compilation summary is. Values: 0 (never print summary), 1 (print summary only if there are errors or warnings), 2 (print summary if type checking is on), 3 (always print summary). The default level is 1
      • setExtraAnnotationNames

        public void setExtraAnnotationNames​(java.lang.Iterable<java.lang.String> extraAnnotationNames)
      • setOutputCharset

        public void setOutputCharset​(java.nio.charset.Charset charset)
        Sets the output charset.
      • setLanguageIn

        public void setLanguageIn​(CompilerOptions.LanguageMode languageIn)
        Sets ECMAScript version to use for the input. If you are not transpiling from one version to another, use #setLanguage instead.
      • setLanguageOut

        public void setLanguageOut​(CompilerOptions.LanguageMode languageOut)
        Sets ECMAScript version to use for the output.

        If you are not transpiling from one version to another, use #setLanguage instead.

        If you you need something more fine grained (e.g. "ES2017 without modules") use #setOutputFeatureSet.

      • legacySetOutputFeatureSet

        public void legacySetOutputFeatureSet​(FeatureSet featureSet)
      • getOutputFeatureSet

        public FeatureSet getOutputFeatureSet()
        Gets the set of features that can appear in the output.
      • setForceClassTranspilation

        public void setForceClassTranspilation​(boolean forceClassTranspilation)
      • getForceClassTranspilation

        public boolean getForceClassTranspilation()
      • needsTranspilationFrom

        public boolean needsTranspilationFrom​(FeatureSet languageLevel)
      • needsTranspilationOf

        public boolean needsTranspilationOf​(FeatureSet.Feature feature)
      • setErrorHandler

        public void setErrorHandler​(ErrorHandler handler)
        Set a custom handler for warnings and errors.

        This is mostly used for piping the warnings and errors to a file behind the scenes.

        If you want to filter warnings and errors, you should use a WarningsGuard.

        If you want to change how warnings and errors are reported to the user, you should set a ErrorManager on the Compiler. An ErrorManager is intended to summarize the errors for a single compile job.

      • setInferTypes

        public void setInferTypes​(boolean enable)
        If true, enables type inference. If checkTypes is enabled, this flag has no effect.
      • getInferTypes

        public boolean getInferTypes()
        Gets the inferTypes flag. Note that if checkTypes is enabled, this flag is ignored when configuring the compiler.
      • setNewTypeInference

        @Deprecated
        public void setNewTypeInference​(boolean enable)
        Deprecated.
        This is a no-op.
      • setAllowZoneJsWithAsyncFunctionsInOutput

        public void setAllowZoneJsWithAsyncFunctionsInOutput​(boolean enable)
      • isTypecheckingEnabled

        public boolean isTypecheckingEnabled()
        Returns:
        true if either typechecker is ON.
      • assumeStrictThis

        public boolean assumeStrictThis()
        Returns:
        Whether assumeStrictThis is set.
      • setAssumeStrictThis

        public void setAssumeStrictThis​(boolean enable)
        If true, enables enables additional optimizations.
      • assumeClosuresOnlyCaptureReferences

        public boolean assumeClosuresOnlyCaptureReferences()
        Returns:
        Whether assumeClosuresOnlyCaptureReferences is set.
      • setAssumeClosuresOnlyCaptureReferences

        public void setAssumeClosuresOnlyCaptureReferences​(boolean enable)
        Whether to assume closures capture only what they reference. This allows more aggressive function inlining.
      • setPropertiesThatMustDisambiguate

        public void setPropertiesThatMustDisambiguate​(java.util.Set<java.lang.String> names)
        Sets the list of properties that we report property invalidation errors for.
      • getPropertiesThatMustDisambiguate

        public com.google.common.collect.ImmutableSet<java.lang.String> getPropertiesThatMustDisambiguate()
      • setPreserveDetailedSourceInfo

        public void setPreserveDetailedSourceInfo​(boolean preserveDetailedSourceInfo)
      • setPreserveNonJSDocComments

        public void setPreserveNonJSDocComments​(boolean preserveNonJSDocComments)
      • setContinueAfterErrors

        public void setContinueAfterErrors​(boolean continueAfterErrors)
      • setParseJsDocDocumentation

        public void setParseJsDocDocumentation​(Config.JsDocParsing parseJsDocDocumentation)
        Enables or disables the parsing of JSDoc documentation, and optionally also the preservation of all whitespace and formatting within a JSDoc comment. By default, whitespace is collapsed for all comments except @license and @preserve blocks,
      • isParseJsDocDocumentation

        public Config.JsDocParsing isParseJsDocDocumentation()
        Checks JSDoc documentation will be parsed.
        Returns:
        True when JSDoc documentation will be parsed, false if not.
      • setSkipNonTranspilationPasses

        public void setSkipNonTranspilationPasses​(boolean skipNonTranspilationPasses)
        Skip all passes (other than transpilation, if requested). Don't inject any runtime libraries (unless explicitly requested) or do any checks/optimizations (this is useful for per-file transpilation).
      • setCheckDeterminism

        public void setCheckDeterminism​(boolean checkDeterminism)
      • getCheckDeterminism

        public boolean getCheckDeterminism()
      • setMessageBundle

        public void setMessageBundle​(MessageBundle messageBundle)
      • setCheckSymbols

        public void setCheckSymbols​(boolean checkSymbols)
      • setCheckSuspiciousCode

        public void setCheckSuspiciousCode​(boolean checkSuspiciousCode)
      • setCheckTypes

        public void setCheckTypes​(boolean checkTypes)
      • setFoldConstants

        public void setFoldConstants​(boolean foldConstants)
      • setDeadAssignmentElimination

        public void setDeadAssignmentElimination​(boolean deadAssignmentElimination)
      • setInlineConstantVars

        public void setInlineConstantVars​(boolean inlineConstantVars)
      • setCrossChunkCodeMotion

        public void setCrossChunkCodeMotion​(boolean crossChunkCodeMotion)
      • setCrossChunkCodeMotionNoStubMethods

        public void setCrossChunkCodeMotionNoStubMethods​(boolean crossChunkCodeMotionNoStubMethods)
      • setParentChunkCanSeeSymbolsDeclaredInChildren

        public void setParentChunkCanSeeSymbolsDeclaredInChildren​(boolean parentChunkCanSeeSymbolsDeclaredInChildren)
      • setCrossChunkMethodMotion

        public void setCrossChunkMethodMotion​(boolean crossChunkMethodMotion)
      • setCoalesceVariableNames

        public void setCoalesceVariableNames​(boolean coalesceVariableNames)
      • setInlineLocalVariables

        public void setInlineLocalVariables​(boolean inlineLocalVariables)
      • setFlowSensitiveInlineVariables

        public void setFlowSensitiveInlineVariables​(boolean enabled)
      • setSmartNameRemoval

        public void setSmartNameRemoval​(boolean smartNameRemoval)
      • setRemoveDeadCode

        public void setRemoveDeadCode​(boolean removeDeadCode)
      • setExtractPrototypeMemberDeclarations

        public void setExtractPrototypeMemberDeclarations​(boolean enabled)
      • setRemoveUnusedPrototypeProperties

        public void setRemoveUnusedPrototypeProperties​(boolean enabled)
      • setCollapseVariableDeclarations

        public void setCollapseVariableDeclarations​(boolean enabled)
      • setCollapseAnonymousFunctions

        public void setCollapseAnonymousFunctions​(boolean enabled)
      • setOutputJsStringUsage

        public void setOutputJsStringUsage​(boolean outputJsStringUsage)
      • setConvertToDottedProperties

        public void setConvertToDottedProperties​(boolean convertToDottedProperties)
      • setUseTypesForLocalOptimization

        public void setUseTypesForLocalOptimization​(boolean useTypesForLocalOptimization)
      • shouldUseTypesForLocalOptimization

        public boolean shouldUseTypesForLocalOptimization()
      • setUseTypesForOptimization

        @Deprecated
        public void setUseTypesForOptimization​(boolean useTypesForOptimization)
        Deprecated.
      • setRewriteFunctionExpressions

        public void setRewriteFunctionExpressions​(boolean rewriteFunctionExpressions)
      • setOptimizeCalls

        public void setOptimizeCalls​(boolean optimizeCalls)
      • getOptimizeESClassConstructors

        public boolean getOptimizeESClassConstructors()
      • setOptimizeESClassConstructors

        public void setOptimizeESClassConstructors​(boolean optimizeESClassConstructors)
      • setOptimizeArgumentsArray

        public void setOptimizeArgumentsArray​(boolean optimizeArgumentsArray)
      • setLabelRenaming

        public void setLabelRenaming​(boolean labelRenaming)
      • setReserveRawExports

        public void setReserveRawExports​(boolean reserveRawExports)
      • setPreferStableNames

        public void setPreferStableNames​(boolean preferStableNames)
      • setGeneratePseudoNames

        public void setGeneratePseudoNames​(boolean generatePseudoNames)
      • setPropertyRenamingOnlyCompilationMode

        public void setPropertyRenamingOnlyCompilationMode​(boolean propertyRenamingOnlyCompilationMode)
      • isPropertyRenamingOnlyCompilationMode

        public boolean isPropertyRenamingOnlyCompilationMode()
      • setRenamePrefix

        public void setRenamePrefix​(java.lang.String renamePrefix)
      • getRenamePrefixNamespace

        public java.lang.String getRenamePrefixNamespace()
      • setRenamePrefixNamespace

        public void setRenamePrefixNamespace​(java.lang.String renamePrefixNamespace)
      • setCollapseProperties

        @Deprecated
        public void setCollapseProperties​(boolean fullyCollapse)
        Deprecated.
      • setDevirtualizeMethods

        public void setDevirtualizeMethods​(boolean devirtualizeMethods)
      • setComputeFunctionSideEffects

        public void setComputeFunctionSideEffects​(boolean computeFunctionSideEffects)
      • setDisambiguateProperties

        public void setDisambiguateProperties​(boolean disambiguateProperties)
      • shouldDisambiguateProperties

        public boolean shouldDisambiguateProperties()
      • setAmbiguateProperties

        public void setAmbiguateProperties​(boolean ambiguateProperties)
      • shouldAmbiguateProperties

        public boolean shouldAmbiguateProperties()
      • setInputVariableMap

        public void setInputVariableMap​(VariableMap inputVariableMap)
      • setInputPropertyMap

        public void setInputPropertyMap​(VariableMap inputPropertyMap)
      • setExportTestFunctions

        public void setExportTestFunctions​(boolean exportTestFunctions)
      • setSyntheticBlockStartMarker

        public void setSyntheticBlockStartMarker​(java.lang.String syntheticBlockStartMarker)
      • setSyntheticBlockEndMarker

        public void setSyntheticBlockEndMarker​(java.lang.String syntheticBlockEndMarker)
      • setLocale

        public void setLocale​(java.lang.String locale)
      • setDoLateLocalization

        public void setDoLateLocalization​(boolean doLateLocalization)
      • doLateLocalization

        public boolean doLateLocalization()
      • shouldRunReplaceMessagesPass

        public boolean shouldRunReplaceMessagesPass()
        Should we run any form of the `ReplaceMessages` pass?
      • setMarkAsCompiled

        public void setMarkAsCompiled​(boolean markAsCompiled)
      • setClosurePass

        public void setClosurePass​(boolean closurePass)
      • setPreserveClosurePrimitives

        public void setPreserveClosurePrimitives​(boolean preserveClosurePrimitives)
        Preserve closure primitives.

        For now, this only preserves goog.provide(), goog.require() and goog.module() calls.

      • shouldPreservesGoogProvidesAndRequires

        public boolean shouldPreservesGoogProvidesAndRequires()
      • shouldPreserveGoogModule

        public boolean shouldPreserveGoogModule()
      • shouldPreserveGoogLibraryPrimitives

        public boolean shouldPreserveGoogLibraryPrimitives()
        Do not process goog. intrinsics, such as goog.getCssName().
      • setPreserveTypeAnnotations

        public void setPreserveTypeAnnotations​(boolean preserveTypeAnnotations)
      • setGentsMode

        public void setGentsMode​(boolean gentsMode)
      • setGatherCssNames

        public void setGatherCssNames​(boolean gatherCssNames)
      • setStripTypes

        @Deprecated
        public void setStripTypes​(java.util.Set<java.lang.String> stripTypes)
        Deprecated.
        StripCode is deprecated. Code should be designed to be removed by other means.
      • getStripTypes

        @Deprecated
        public com.google.common.collect.ImmutableSet<java.lang.String> getStripTypes()
        Deprecated.
        StripCode is deprecated. Code should be designed to be removed by other means.
      • setStripNameSuffixes

        @Deprecated
        public void setStripNameSuffixes​(java.util.Set<java.lang.String> stripNameSuffixes)
        Deprecated.
        StripCode is deprecated. Code should be designed to be removed by other means.
      • setStripNamePrefixes

        @Deprecated
        public void setStripNamePrefixes​(java.util.Set<java.lang.String> stripNamePrefixes)
        Deprecated.
        StripCode is deprecated. Code should be designed to be removed by other means.
      • setDefineReplacements

        public void setDefineReplacements​(java.util.Map<java.lang.String,​java.lang.Object> defineReplacements)
      • setMoveFunctionDeclarations

        @InlineMe(replacement="this.setRewriteGlobalDeclarationsForTryCatchWrapping(moveFunctionDeclarations)")
        @Deprecated
        public final void setMoveFunctionDeclarations​(boolean moveFunctionDeclarations)
        Deprecated.
      • setRewriteGlobalDeclarationsForTryCatchWrapping

        public void setRewriteGlobalDeclarationsForTryCatchWrapping​(boolean rewrite)
      • setCssRenamingMap

        public void setCssRenamingMap​(CssRenamingMap cssRenamingMap)
      • setCssRenamingWhitelist

        @InlineMe(replacement="this.setCssRenamingSkiplist(skiplist)")
        @Deprecated
        public final void setCssRenamingWhitelist​(java.util.Set<java.lang.String> skiplist)
        Deprecated.
      • setCssRenamingSkiplist

        public void setCssRenamingSkiplist​(java.util.Set<java.lang.String> skiplist)
      • setReplaceStringsFunctionDescriptions

        public void setReplaceStringsFunctionDescriptions​(java.util.List<java.lang.String> replaceStringsFunctionDescriptions)
      • setParenthesizeFunctionsInChunks

        public void setParenthesizeFunctionsInChunks​(java.util.List<java.lang.String> parenthesizeFunctionsInChunks)
      • setReplaceStringsPlaceholderToken

        public void setReplaceStringsPlaceholderToken​(java.lang.String replaceStringsPlaceholderToken)
      • setPrettyPrint

        public void setPrettyPrint​(boolean prettyPrint)
      • isPrettyPrint

        public boolean isPrettyPrint()
      • setLineBreak

        public void setLineBreak​(boolean lineBreak)
      • getPreferLineBreakAtEndOfFile

        public boolean getPreferLineBreakAtEndOfFile()
      • setPreferLineBreakAtEndOfFile

        public void setPreferLineBreakAtEndOfFile​(boolean lineBreakAtEnd)
      • setPrintInputDelimiter

        public void setPrintInputDelimiter​(boolean printInputDelimiter)
      • setInputDelimiter

        public void setInputDelimiter​(java.lang.String inputDelimiter)
      • setDebugLogDirectory

        public void setDebugLogDirectory​(@Nullable java.nio.file.Path dir)
      • getDebugLogDirectory

        public @Nullable java.nio.file.Path getDebugLogDirectory()
      • setDebugLogFilter

        public void setDebugLogFilter​(java.lang.String filter)
      • getDebugLogFilter

        public java.lang.String getDebugLogFilter()
      • setQuoteKeywordProperties

        public void setQuoteKeywordProperties​(boolean quoteKeywordProperties)
      • shouldQuoteKeywordProperties

        public boolean shouldQuoteKeywordProperties()
      • setErrorFormat

        public void setErrorFormat​(ErrorFormat errorFormat)
      • setLineLengthThreshold

        public void setLineLengthThreshold​(int lineLengthThreshold)
      • getLineLengthThreshold

        public int getLineLengthThreshold()
      • setUseOriginalNamesInOutput

        public void setUseOriginalNamesInOutput​(boolean useOriginalNamesInOutput)
      • getUseOriginalNamesInOutput

        public boolean getUseOriginalNamesInOutput()
      • setExternExportsPath

        public void setExternExportsPath​(@Nullable java.lang.String externExportsPath)
      • getExternExportsPath

        public @Nullable java.lang.String getExternExportsPath()
      • setSourceMapOutputPath

        public void setSourceMapOutputPath​(java.lang.String sourceMapOutputPath)
      • setApplyInputSourceMaps

        public void setApplyInputSourceMaps​(boolean applyInputSourceMaps)
      • setResolveSourceMapAnnotations

        public void setResolveSourceMapAnnotations​(boolean resolveSourceMapAnnotations)
      • setSourceMapIncludeSourcesContent

        public void setSourceMapIncludeSourcesContent​(boolean sourceMapIncludeSourcesContent)
      • setParseInlineSourceMaps

        public void setParseInlineSourceMaps​(boolean parseInlineSourceMaps)
      • setSourceMapDetailLevel

        public void setSourceMapDetailLevel​(SourceMap.DetailLevel sourceMapDetailLevel)
      • setSourceMapFormat

        public void setSourceMapFormat​(SourceMap.Format sourceMapFormat)
      • setSourceMapLocationMappings

        public void setSourceMapLocationMappings​(java.util.List<? extends SourceMap.LocationMapping> sourceMapLocationMappings)
      • setTransformAMDToCJSModules

        public void setTransformAMDToCJSModules​(boolean transformAMDToCJSModules)
        Activates transformation of AMD to CommonJS modules.
      • setProcessCommonJSModules

        public void setProcessCommonJSModules​(boolean processCommonJSModules)
        Rewrites CommonJS modules so that modules can be concatenated together, by renaming all globals to avoid conflicting with other modules.
      • getProcessCommonJSModules

        public boolean getProcessCommonJSModules()
      • setCommonJSModulePathPrefix

        public void setCommonJSModulePathPrefix​(java.lang.String commonJSModulePathPrefix)
        Sets a path prefix for CommonJS modules (maps to setModuleRoots(List)).
      • setModuleRoots

        public void setModuleRoots​(java.util.List<java.lang.String> moduleRoots)
        Sets the module roots.
      • setRewritePolyfills

        public void setRewritePolyfills​(boolean rewritePolyfills)
        Sets whether to rewrite polyfills.
      • getRewritePolyfills

        public boolean getRewritePolyfills()
      • setIsolatePolyfills

        public void setIsolatePolyfills​(boolean isolatePolyfills)
        Sets whether to isolate polyfills from the global scope.
      • getIsolatePolyfills

        public boolean getIsolatePolyfills()
      • setForceLibraryInjection

        public void setForceLibraryInjection​(java.lang.Iterable<java.lang.String> libraries)
        Sets list of libraries to always inject, even if not needed.
      • setPreventLibraryInjection

        public void setPreventLibraryInjection​(boolean preventLibraryInjection)
        Sets the set of libraries to never inject, even if required.
      • setUnusedImportsToRemove

        public void setUnusedImportsToRemove​(@Nullable com.google.common.collect.ImmutableSet<java.lang.String> unusedImportsToRemove)
      • getUnusedImportsToRemove

        public @Nullable com.google.common.collect.ImmutableSet<java.lang.String> getUnusedImportsToRemove()
      • setProductionInstrumentationArrayName

        public void setProductionInstrumentationArrayName​(java.lang.String productionInstrumentationArrayName)
        Sets the name for the global array which is used by PRODUCTION instrumentation. The array is declared during the instrumentation pass with the name provided through this setter.
      • getProductionInstrumentationArrayName

        public java.lang.String getProductionInstrumentationArrayName()
      • getConformanceConfigs

        public final com.google.common.collect.ImmutableList<com.google.javascript.jscomp.ConformanceConfig> getConformanceConfigs()
      • setConformanceConfig

        @GwtIncompatible("Conformance")
        public void setConformanceConfig​(com.google.javascript.jscomp.ConformanceConfig conformanceConfig)
        Both enable and configure conformance checks, if non-null.
      • setConformanceConfigs

        @GwtIncompatible("Conformance")
        public void setConformanceConfigs​(java.util.List<com.google.javascript.jscomp.ConformanceConfig> configs)
        Both enable and configure conformance checks, if non-null.
      • clearConformanceConfigs

        public void clearConformanceConfigs()
      • shouldEmitUseStrict

        public boolean shouldEmitUseStrict()
        Whether the output should contain a 'use strict' directive.
      • setEmitUseStrict

        @CanIgnoreReturnValue
        public CompilerOptions setEmitUseStrict​(boolean emitUseStrict)
      • getBrowserResolverPrefixReplacements

        public com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> getBrowserResolverPrefixReplacements()
      • setBrowserResolverPrefixReplacements

        public void setBrowserResolverPrefixReplacements​(com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> browserResolverPrefixReplacements)
      • getPackageJsonEntryNames

        public java.util.List<java.lang.String> getPackageJsonEntryNames()
      • setPackageJsonEntryNames

        public void setPackageJsonEntryNames​(java.util.List<java.lang.String> names)
      • setUseSizeHeuristicToStopOptimizationLoop

        public void setUseSizeHeuristicToStopOptimizationLoop​(boolean mayStopEarly)
      • setMaxOptimizationLoopIterations

        public void setMaxOptimizationLoopIterations​(int maxIterations)
      • serialize

        @GwtIncompatible("ObjectOutputStream")
        public void serialize​(java.io.OutputStream objectOutputStream)
                       throws java.io.IOException
        Serializes compiler options to a stream.
        Throws:
        java.io.IOException
      • deserialize

        @GwtIncompatible("ObjectInputStream")
        public static CompilerOptions deserialize​(java.io.InputStream objectInputStream)
                                           throws java.io.IOException,
                                                  java.lang.ClassNotFoundException
        Deserializes compiler options from a stream.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • setStrictMessageReplacement

        public void setStrictMessageReplacement​(boolean strictMessageReplacement)
      • getStrictMessageReplacement

        public boolean getStrictMessageReplacement()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • expectStrictModeInput

        public boolean expectStrictModeInput()
      • setStrictModeInput

        @CanIgnoreReturnValue
        public CompilerOptions setStrictModeInput​(boolean isStrictModeInput)
      • getPropertyReservedNamingFirstChars

        public char[] getPropertyReservedNamingFirstChars()
      • getPropertyReservedNamingNonFirstChars

        public char[] getPropertyReservedNamingNonFirstChars()