com.google.javascript.jscomp
Class CompilerOptions

java.lang.Object
  extended by com.google.javascript.jscomp.CompilerOptions
All Implemented Interfaces:
Serializable, Cloneable

public class CompilerOptions
extends Object
implements Serializable, Cloneable

Compiler options

See Also:
Serialized Form

Nested Class Summary
static interface CompilerOptions.AliasTransformation
          A Role Specific Interface for the JsCompiler to report aliases used to change the code during a compile.
static interface CompilerOptions.AliasTransformationHandler
          A Role Specific Interface for JsCompiler that represents a data holder object which is used to store goog.scope alias code changes to code made during a compile.
static class CompilerOptions.TracerMode
           
static class CompilerOptions.TweakProcessing
           
 
Field Summary
 CheckLevel aggressiveVarCheck
          Checks for suspicious variable definitions and undefined variables
 String aliasableGlobals
          If set to a non-empty string, then during an alias externals pass only externals with these names will be considered for aliasing.
 Set<String> aliasableStrings
          If set to a non-empty set, those strings literals will be aliased to a single global instance per string, to avoid creating more objects than necessary.
 boolean aliasAllStrings
          Aliases all string literals to global instances, to avoid creating more objects than necessary (if true, overrides any set of strings passed in to aliasableStrings)
 boolean aliasExternals
          Adds variable aliases for externals to reduce code size
 boolean aliasKeywords
          Aliases true, false, and null to variables with shorter names.
 String aliasStringsBlacklist
          A blacklist in the form of a regular expression to block strings that contains certain words from being aliased.
 boolean allowLegacyJsMessages
          Allows old deprecated js message style
 boolean ambiguateProperties
          Rename unrelated properties to the same name to reduce code size.
 AnonymousFunctionNamingPolicy anonymousFunctionNaming
          Give anonymous functions names for easier debugging
 String appNameStr
          App identifier string for use by the instrumentation template's app_name_setter
 CheckLevel brokenClosureRequiresLevel
          Sets the check level for bad Closure require calls.
 boolean checkCaja
          Checks that the synctactic restrictions of Caja are met.
 boolean checkControlStructures
          Checks for invalid control structures
 boolean checkDuplicateMessages
          Makes sure no duplicate messages
 boolean checkEs5Strict
          Checks that the synctactic restrictions of ES5 strict mode are met.
 CheckLevel checkFunctions
          Checks function arity
 CheckLevel checkGlobalNamesLevel
          Checks the integrity of references to qualified global names.
 CheckLevel checkGlobalThisLevel
          Checks for certain uses of the this keyword that are considered unsafe because they are likely to reference the global this object unintentionally.
 CheckLevel checkMethods
          Checks method arity
 String checkMissingGetCssNameBlacklist
          Regex of string literals that may only appear in goog.getCssName arguments.
 CheckLevel checkMissingGetCssNameLevel
          Checks that certain string literals only appear in strings used as goog.getCssName arguments.
 CheckLevel checkMissingReturn
          Checks for missing return statements
 CheckLevel checkProvides
          Checks for missing goog.provides() calls
 CheckLevel checkRequires
          Checks for missing goog.require() calls
 CheckLevel checkShadowVars
          Checks that all variables with the @noshadow attribute are never shadowed.
 boolean checkSuspiciousCode
          Checks for suspicious statements that have no effect
 boolean checkSymbols
          Checks that all symbols are defined
 boolean checkTypedPropertyCalls
          Checks for inexistant property calls
 boolean checkTypes
          Checks types on expressions
 CheckLevel checkUndefinedProperties
          Checks for non-extern properties that are read but never set.
 CheckLevel checkUnreachableCode
          Checks for unreachable code
 boolean checkUnusedPropertiesEarly
          Checks for non-extern properties that are written but never read.
 boolean closurePass
          Processes goog.provide() and goog.require() calls
 boolean coalesceVariableNames
          Merge two variables together as one.
 boolean collapseAnonymousFunctions
          Collapses anonymous function declarations into named function declarations
 boolean collapseProperties
          Flattens multi-level property names (e.g.
 boolean collapseVariableDeclarations
          Collapses multiple variable declarations into one
 boolean computeFunctionSideEffects
          Use @nosideeffects annotations, function bodies and name graph to determine if calls have side effects.
 boolean convertToDottedProperties
          Converts quoted property accesses to dot syntax (a['b'] -> a.b)
 boolean crossModuleCodeMotion
          Move code to a deeper module
 boolean crossModuleMethodMotion
          Move methds to a deeper module
 CssRenamingMap cssRenamingMap
          Map used in the renaming of CSS class names.
 com.google.common.collect.Multimap<CustomPassExecutionTime,CompilerPass> customPasses
          Custom passes
 boolean deadAssignmentElimination
           
 String debugFunctionSideEffectsPath
          Where to save debug report for compute function side effects.
 boolean decomposeExpressions
          Enhanced function inlining
 boolean devirtualizePrototypeMethods
          Devirtualize prototype method by rewriting them to be static calls that take the this pointer as their first argument
 boolean disambiguateProperties
          Rename properties to disambiguate between unrelated fields based on type information.
 ErrorFormat errorFormat
           
 boolean exportTestFunctions
          Whether to export test functions.
 boolean extractPrototypeMemberDeclarations
          Extracts common prototype member declarations
 boolean flowSensitiveInlineVariables
           
 boolean foldConstants
          Folds constants (e.g.
 boolean gatherCssNames
          Gather CSS names (requires closurePass)
 boolean generateExports
           
 boolean generatePseudoNames
          Generate pseudo names for variables and properties for debugging purposes.
 boolean groupVariableDeclarations
          Group multiple variable declarations into one
 boolean ideMode
          Configures the compiler for use as an IDE backend.
 boolean ignoreCajaProperties
          Add code to skip properties that Caja adds to Object.prototype
 boolean inferTypesInGlobalScope
          Runs a flow sensitive type inference in the global scope
 boolean inlineAnonymousFunctionExpressions
          Enhanced function inlining
 boolean inlineConstantVars
          Inlines constants (symbols that are all CAPS)
 boolean inlineFunctions
          Inlines short functions
 boolean inlineGetters
          Inlines trivial getters
 boolean inlineLocalFunctions
          Enhanced function inlining
 boolean inlineLocalVariables
          Inlines variables
 boolean inlineVariables
          Inlines variables
 String inputDelimiter
          The string to use as the separator for printInputDelimiter
 byte[] inputPropertyMapSerialized
          Serialized input property renaming map.
 byte[] inputVariableMapSerialized
          Serialized input variable renaming map.
 String instrumentationTemplate
          Instrumentation template to use
 boolean instrumentForCoverage
          Instrument code for the purpose of collecting coverage data.
 boolean instrumentForCoverageOnly
          Instrument code for the purpose of collecting coverage data - restrict to coverage pass only, and skip all other passes.
 String jsOutputFile
           
 boolean labelRenaming
          Controls label renaming.
 boolean lineBreak
          Line break the output a bit more aggressively
 String locale
          Compiling locale
 boolean markAsCompiled
          Sets the special "COMPILED" value to true
 boolean markNoSideEffectCalls
          Mark no side effect calls
 MessageBundle messageBundle
          Returns localized replacement for MSG_* variables
 boolean moveFunctionDeclarations
          Move top level function declarations to the top
 String nameReferenceGraphPath
          Where to save the name reference graph
 String nameReferenceReportPath
          Where to save a cross-reference report from the name reference graph
 boolean optimizeArgumentsArray
          Provide formal names for elements of arguments array.
 boolean optimizeCalls
          Remove unused parameters from call sites.
 boolean optimizeParameters
          Remove unused and constant parameters.
 boolean optimizeReturns
          Remove unused return values.
 boolean prettyPrint
          Output in pretty indented format
 boolean printInputDelimiter
          Prints a separator comment before each js script
 PropertyRenamingPolicy propertyRenaming
          Controls which properties get renamed.
 boolean recordFunctionInformation
          Record function information
 boolean removeDeadCode
          Removes code that will never execute
 boolean removeEmptyFunctions
          Removes functions that have no body
 boolean removeTryCatchFinally
          Removes try...catch...finally blocks for easier debugging
 boolean removeUnusedLocalVars
          Removes unused variables in local scope.
 boolean removeUnusedPrototypeProperties
          Removes unused member prototypes
 boolean removeUnusedPrototypePropertiesInExterns
          Tells AnalyzePrototypeProperties it can remove externed props.
 boolean removeUnusedVars
          Removes unused variables
 String renamePrefix
          Specifies a prefix for all globals
 CheckLevel reportMissingOverride
          Flags a warning if a property is missing the @override annotation, but it overrides a base class property.
 String reportPath
          Where to save a report of global name usage
 CheckLevel reportUnknownTypes
          Flags a warning for every node whose type could not be determined.
 boolean reserveRawExports
          Reserve property names on the global this object.
 boolean rewriteFunctionExpressions
          Reduces the size of common function expressions.
 boolean smartNameRemoval
          Removes code associated with unused global names
 SourceMap.DetailLevel sourceMapDetailLevel
          The detail level for the generated source map.
 SourceMap.Format sourceMapFormat
          The source map file format
 String sourceMapOutputPath
          The output path for the source map.
 boolean specializeInitialModule
          Specialize the initial module at the cost of later modules
 boolean strictMessageReplacement
          Whether we should throw an exception in case if the message absent from a bundle.
 Set<String> stripNamePrefixes
          Name prefixes that determine which variables and properties to strip
 Set<String> stripNameSuffixes
          Name suffixes that determine which variables and properties to strip
 Set<String> stripTypePrefixes
          Qualified type name prefixes that determine which types to strip
 Set<String> stripTypes
          Names of types to strip
 String syntheticBlockEndMarker
           
 String syntheticBlockStartMarker
           
 boolean tightenTypes
          Tightens types based on a global analysis.
 CompilerOptions.TracerMode tracer
           
 String unaliasableGlobals
          Additional globals that can not be aliased since they may be undefined or can cause errors.
 VariableRenamingPolicy variableRenaming
          Controls which variables get renamed.
 
Constructor Summary
CompilerOptions()
          Initializes compiler options.
 
Method Summary
 void addWarningsGuard(WarningsGuard guard)
          Add a guard to the set of warnings guards.
 Object clone()
           
 void disableRuntimeTypeCheck()
           
 void enableExternExports(boolean enable)
           
 void enableRuntimeTypeCheck(String logFunction)
          Enable runtime type checking, which adds JS type assertions for debugging.
 CompilerOptions.AliasTransformationHandler getAliasTransformationHandler()
           
 CodingConvention getCodingConvention()
           
 Map<String,Node> getDefineReplacements()
          Returns the map of define replacements.
 com.google.javascript.jscomp.CompilerOptions.LanguageMode getLanguageIn()
           
 com.google.javascript.jscomp.CompilerOptions.LanguageMode getLanguageOut()
           
 CompilerOptions.TweakProcessing getTweakProcessing()
           
 Map<String,Node> getTweakReplacements()
          Returns the map of tweak replacements.
 boolean isExternExportsEnabled()
           
 void lineLengthThreshold(int value)
           
 void setAcceptConstKeyword(boolean value)
          If true, accept `const' keyword.
 void setAliasTransformationHandler(CompilerOptions.AliasTransformationHandler changes)
           
 void setChainCalls(boolean value)
          If true, chain calls to functions that return this.
 void setCodingConvention(CodingConvention codingConvention)
           
 void setCollapsePropertiesOnExternTypes(boolean collapse)
          If true, flattens multi-level property names on extern types (e.g.
 void setColorizeErrorOutput(boolean colorizeErrorOutput)
           
 void setDefineToBooleanLiteral(String defineName, boolean value)
          Sets the value of the @define variable in JS to a boolean literal.
 void setDefineToDoubleLiteral(String defineName, double value)
          Sets the value of the @define variable in JS to a number literal.
 void setDefineToNumberLiteral(String defineName, int value)
          Sets the value of the @define variable in JS to a number literal.
 void setDefineToStringLiteral(String defineName, String value)
          Sets the value of the @define variable in JS to a String literal.
 void setGenerateExports(boolean generateExports)
           
 void setIdGenerators(Set<String> idGenerators)
          Sets the id generators to replace.
 void setLanguageIn(com.google.javascript.jscomp.CompilerOptions.LanguageMode languageIn)
          Sets how goog.tweak calls are processed.
 void setLooseTypes(boolean looseTypes)
          Whether to include "undefined" in the default types.
 void setManageClosureDependencies(boolean newVal)
          Sort inputs by their goog.provide/goog.require calls, and prune inputs whose symbols are not required.
 void setManageClosureDependencies(List<String> entryPoints)
          Sort inputs by their goog.provide/goog.require calls.
 void setNameAnonymousFunctionsOnly(boolean value)
          If true, name anonymous functions only.
 void setOutputCharset(String charsetName)
          Sets the output charset by name.
 void setProcessObjectPropertyString(boolean process)
          If true, process goog.testing.ObjectPropertyString instances.
 void setRemoveAbstractMethods(boolean remove)
           
 void setRemoveClosureAsserts(boolean remove)
           
 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.
 void setReplaceStringsConfiguration(String placeholderToken, List<String> functionDescriptors)
          Sets the functions whose debug strings to replace.
 void setRewriteNewDateGoogNow(boolean rewrite)
           
 void setShadowVariables(boolean shadow)
          Should shadow outer scope variable name during renaming.
 void setSummaryDetailLevel(int summaryDetailLevel)
          Controls how detailed the compilation summary is.
 void setTweakProcessing(CompilerOptions.TweakProcessing tweakProcessing)
          Sets how goog.tweak calls are processed.
 void setTweakToBooleanLiteral(String tweakId, boolean value)
          Sets the value of the tweak in JS to a boolean literal.
 void setTweakToDoubleLiteral(String tweakId, double value)
          Sets the value of the tweak in JS to a number literal.
 void setTweakToNumberLiteral(String tweakId, int value)
          Sets the value of the tweak in JS to a number literal.
 void setTweakToStringLiteral(String tweakId, String value)
          Sets the value of the tweak in JS to a String literal.
 void setWarningLevel(DiagnosticGroup type, CheckLevel level)
          Configure the given type of warning to the given level.
 boolean shouldColorizeErrorOutput()
           
 void skipAllCompilerPasses()
          Skip all possible passes, to make the compiler as fast as possible.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ideMode

public boolean ideMode
Configures the compiler for use as an IDE backend. In this mode:


messageBundle

public transient MessageBundle messageBundle
Returns localized replacement for MSG_* variables


checkSymbols

public boolean checkSymbols
Checks that all symbols are defined


checkShadowVars

public CheckLevel checkShadowVars
Checks that all variables with the @noshadow attribute are never shadowed.


aggressiveVarCheck

public CheckLevel aggressiveVarCheck
Checks for suspicious variable definitions and undefined variables


checkFunctions

public CheckLevel checkFunctions
Checks function arity


checkMethods

public CheckLevel checkMethods
Checks method arity


checkDuplicateMessages

public boolean checkDuplicateMessages
Makes sure no duplicate messages


allowLegacyJsMessages

public boolean allowLegacyJsMessages
Allows old deprecated js message style


strictMessageReplacement

public boolean strictMessageReplacement
Whether we should throw an exception in case if the message absent from a bundle.


checkSuspiciousCode

public boolean checkSuspiciousCode
Checks for suspicious statements that have no effect


checkControlStructures

public boolean checkControlStructures
Checks for invalid control structures


checkUndefinedProperties

public CheckLevel checkUndefinedProperties
Checks for non-extern properties that are read but never set.


checkUnusedPropertiesEarly

public boolean checkUnusedPropertiesEarly
Checks for non-extern properties that are written but never read. This check occurs after the first constant-based dead code removal pass, but before the main optimization loop. This is noisy if you are including libraries with methods that you don't use, so it is off by default.


checkTypes

public boolean checkTypes
Checks types on expressions


tightenTypes

public boolean tightenTypes
Tightens types based on a global analysis.


inferTypesInGlobalScope

public boolean inferTypesInGlobalScope
Runs a flow sensitive type inference in the global scope


checkTypedPropertyCalls

public boolean checkTypedPropertyCalls
Checks for inexistant property calls


reportMissingOverride

public CheckLevel reportMissingOverride
Flags a warning if a property is missing the @override annotation, but it overrides a base class property.


reportUnknownTypes

public CheckLevel reportUnknownTypes
Flags a warning for every node whose type could not be determined.


checkRequires

public CheckLevel checkRequires
Checks for missing goog.require() calls


checkProvides

public CheckLevel checkProvides
Checks for missing goog.provides() calls


checkGlobalNamesLevel

public CheckLevel checkGlobalNamesLevel
Checks the integrity of references to qualified global names. (e.g. "a.b")


brokenClosureRequiresLevel

public CheckLevel brokenClosureRequiresLevel
Sets the check level for bad Closure require calls.


checkGlobalThisLevel

public CheckLevel checkGlobalThisLevel
Checks for certain uses of the this keyword that are considered unsafe because they are likely to reference the global this object unintentionally. If this is off, but collapseProperties is on, then the compiler will usually ignore you and run this check anyways.


checkMissingGetCssNameLevel

public CheckLevel checkMissingGetCssNameLevel
Checks that certain string literals only appear in strings used as goog.getCssName arguments.


checkMissingGetCssNameBlacklist

public String checkMissingGetCssNameBlacklist
Regex of string literals that may only appear in goog.getCssName arguments.


checkEs5Strict

public boolean checkEs5Strict
Checks that the synctactic restrictions of ES5 strict mode are met.


checkCaja

public boolean checkCaja
Checks that the synctactic restrictions of Caja are met.


foldConstants

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


deadAssignmentElimination

public boolean deadAssignmentElimination

inlineConstantVars

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


inlineFunctions

public boolean inlineFunctions
Inlines short functions


decomposeExpressions

public boolean decomposeExpressions
Enhanced function inlining


inlineAnonymousFunctionExpressions

public boolean inlineAnonymousFunctionExpressions
Enhanced function inlining


inlineLocalFunctions

public boolean inlineLocalFunctions
Enhanced function inlining


crossModuleCodeMotion

public boolean crossModuleCodeMotion
Move code to a deeper module


coalesceVariableNames

public boolean coalesceVariableNames
Merge two variables together as one.


crossModuleMethodMotion

public boolean crossModuleMethodMotion
Move methds to a deeper module


inlineGetters

public boolean inlineGetters
Inlines trivial getters


inlineVariables

public boolean inlineVariables
Inlines variables


inlineLocalVariables

public boolean inlineLocalVariables
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


checkUnreachableCode

public CheckLevel checkUnreachableCode
Checks for unreachable code


checkMissingReturn

public CheckLevel checkMissingReturn
Checks for missing return statements


extractPrototypeMemberDeclarations

public boolean extractPrototypeMemberDeclarations
Extracts common prototype member declarations


removeEmptyFunctions

public boolean removeEmptyFunctions
Removes functions that have no body


removeUnusedPrototypeProperties

public boolean removeUnusedPrototypeProperties
Removes unused member prototypes


removeUnusedPrototypePropertiesInExterns

public boolean removeUnusedPrototypePropertiesInExterns
Tells AnalyzePrototypeProperties it can remove externed props.


removeUnusedVars

public boolean removeUnusedVars
Removes unused variables


removeUnusedLocalVars

public boolean removeUnusedLocalVars
Removes unused variables in local scope.


aliasExternals

public boolean aliasExternals
Adds variable aliases for externals to reduce code size


aliasableGlobals

public String aliasableGlobals
If set to a non-empty string, then during an alias externals pass only externals with these names will be considered for aliasing.


unaliasableGlobals

public String unaliasableGlobals
Additional globals that can not be aliased since they may be undefined or can cause errors. Comma separated list of symbols. e.g. "foo,bar"


collapseVariableDeclarations

public boolean collapseVariableDeclarations
Collapses multiple variable declarations into one


groupVariableDeclarations

public boolean groupVariableDeclarations
Group multiple variable declarations into one


collapseAnonymousFunctions

public boolean collapseAnonymousFunctions
Collapses anonymous function declarations into named function declarations


aliasableStrings

public Set<String> aliasableStrings
If set to a non-empty set, those strings literals will be aliased to a single global instance per string, to avoid creating more objects than necessary.


aliasStringsBlacklist

public String aliasStringsBlacklist
A blacklist in the form of a regular expression to block strings that contains certain words from being aliased. If the value is the empty string, no words are blacklisted.


aliasAllStrings

public boolean aliasAllStrings
Aliases all string literals to global instances, to avoid creating more objects than necessary (if true, overrides any set of strings passed in to aliasableStrings)


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.


optimizeParameters

public boolean optimizeParameters
Remove unused and constant parameters.


optimizeReturns

public boolean optimizeReturns
Remove unused return values.


optimizeCalls

public boolean optimizeCalls
Remove unused parameters from call sites.


optimizeArgumentsArray

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


variableRenaming

public VariableRenamingPolicy variableRenaming
Controls which variables get renamed.


propertyRenaming

public PropertyRenamingPolicy propertyRenaming
Controls which properties get renamed.


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 String renamePrefix
Specifies a prefix for all globals


aliasKeywords

public boolean aliasKeywords
Aliases true, false, and null to variables with shorter names.


collapseProperties

public boolean collapseProperties
Flattens multi-level property names (e.g. a$b = x)


devirtualizePrototypeMethods

public boolean devirtualizePrototypeMethods
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. Requires --check_types.


debugFunctionSideEffectsPath

public String debugFunctionSideEffectsPath
Where to save debug report for compute function side effects.


disambiguateProperties

public boolean disambiguateProperties
Rename properties to disambiguate between unrelated fields based on type information.


ambiguateProperties

public boolean ambiguateProperties
Rename unrelated properties to the same name to reduce code size.


anonymousFunctionNaming

public AnonymousFunctionNamingPolicy anonymousFunctionNaming
Give anonymous functions names for easier debugging


inputVariableMapSerialized

public byte[] inputVariableMapSerialized
Serialized input variable renaming map.


inputPropertyMapSerialized

public byte[] inputPropertyMapSerialized
Serialized input property renaming map.


exportTestFunctions

public boolean exportTestFunctions
Whether to export test functions.


specializeInitialModule

public boolean specializeInitialModule
Specialize the initial module at the cost of later modules


instrumentForCoverage

public boolean instrumentForCoverage
Instrument code for the purpose of collecting coverage data.


instrumentForCoverageOnly

public boolean instrumentForCoverageOnly
Instrument code for the purpose of collecting coverage data - restrict to coverage pass only, and skip all other passes.


ignoreCajaProperties

public boolean ignoreCajaProperties
Add code to skip properties that Caja adds to Object.prototype


syntheticBlockStartMarker

public String syntheticBlockStartMarker

syntheticBlockEndMarker

public String syntheticBlockEndMarker

locale

public String locale
Compiling locale


markAsCompiled

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


removeTryCatchFinally

public boolean removeTryCatchFinally
Removes try...catch...finally blocks for easier debugging


closurePass

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


gatherCssNames

public boolean gatherCssNames
Gather CSS names (requires closurePass)


stripTypes

public Set<String> stripTypes
Names of types to strip


stripNameSuffixes

public Set<String> stripNameSuffixes
Name suffixes that determine which variables and properties to strip


stripNamePrefixes

public Set<String> stripNamePrefixes
Name prefixes that determine which variables and properties to strip


stripTypePrefixes

public Set<String> stripTypePrefixes
Qualified type name prefixes that determine which types to strip


customPasses

public transient com.google.common.collect.Multimap<CustomPassExecutionTime,CompilerPass> customPasses
Custom passes


markNoSideEffectCalls

public boolean markNoSideEffectCalls
Mark no side effect calls


moveFunctionDeclarations

public boolean moveFunctionDeclarations
Move top level function declarations to the top


instrumentationTemplate

public String instrumentationTemplate
Instrumentation template to use


appNameStr

public String appNameStr
App identifier string for use by the instrumentation template's app_name_setter


recordFunctionInformation

public boolean recordFunctionInformation
Record function information


generateExports

public boolean generateExports

cssRenamingMap

public CssRenamingMap cssRenamingMap
Map used in the renaming of CSS class names.


prettyPrint

public boolean prettyPrint
Output in pretty indented format


lineBreak

public boolean lineBreak
Line break the output a bit more aggressively


printInputDelimiter

public boolean printInputDelimiter
Prints a separator comment before each js script


inputDelimiter

public String inputDelimiter
The string to use as the separator for printInputDelimiter


reportPath

public String reportPath
Where to save a report of global name usage


tracer

public CompilerOptions.TracerMode tracer

errorFormat

public ErrorFormat errorFormat

jsOutputFile

public String jsOutputFile

nameReferenceReportPath

public String nameReferenceReportPath
Where to save a cross-reference report from the name reference graph


nameReferenceGraphPath

public String nameReferenceGraphPath
Where to save the name reference graph


sourceMapOutputPath

public String sourceMapOutputPath
The output path for the source map.


sourceMapDetailLevel

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


sourceMapFormat

public SourceMap.Format sourceMapFormat
The source map file format

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

getDefineReplacements

public Map<String,Node> getDefineReplacements()
Returns the map of define replacements.


getTweakReplacements

public Map<String,Node> getTweakReplacements()
Returns the map of tweak replacements.


setDefineToBooleanLiteral

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


setDefineToStringLiteral

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


setDefineToNumberLiteral

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


setDefineToDoubleLiteral

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


setTweakToBooleanLiteral

public void setTweakToBooleanLiteral(String tweakId,
                                     boolean value)
Sets the value of the tweak in JS to a boolean literal.


setTweakToStringLiteral

public void setTweakToStringLiteral(String tweakId,
                                    String value)
Sets the value of the tweak in JS to a String literal.


setTweakToNumberLiteral

public void setTweakToNumberLiteral(String tweakId,
                                    int value)
Sets the value of the tweak in JS to a number literal.


setTweakToDoubleLiteral

public void setTweakToDoubleLiteral(String tweakId,
                                    double value)
Sets the value of the tweak 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.


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.


setShadowVariables

public void setShadowVariables(boolean shadow)
Should shadow outer scope variable name during renaming.


setCollapsePropertiesOnExternTypes

public void setCollapsePropertiesOnExternTypes(boolean collapse)
If true, flattens multi-level property names on extern types (e.g. String$f = x). This should only be used with the typed version of the externs files.


setProcessObjectPropertyString

public void setProcessObjectPropertyString(boolean process)
If true, process goog.testing.ObjectPropertyString instances.


setIdGenerators

public void setIdGenerators(Set<String> idGenerators)
Sets the id generators to replace.


setReplaceStringsConfiguration

public void setReplaceStringsConfiguration(String placeholderToken,
                                           List<String> functionDescriptors)
Sets the functions whose debug strings to replace.


setRewriteNewDateGoogNow

public void setRewriteNewDateGoogNow(boolean rewrite)

setRemoveAbstractMethods

public void setRemoveAbstractMethods(boolean remove)

setRemoveClosureAsserts

public void setRemoveClosureAsserts(boolean remove)

setNameAnonymousFunctionsOnly

public void setNameAnonymousFunctionsOnly(boolean value)
If true, name anonymous functions only. All other passes will be skipped.


lineLengthThreshold

public void lineLengthThreshold(int value)

setColorizeErrorOutput

public void setColorizeErrorOutput(boolean colorizeErrorOutput)

shouldColorizeErrorOutput

public boolean shouldColorizeErrorOutput()

setChainCalls

public void setChainCalls(boolean value)
If true, chain calls to functions that return this.


setAcceptConstKeyword

public void setAcceptConstKeyword(boolean value)
If true, accept `const' keyword.


enableRuntimeTypeCheck

public void enableRuntimeTypeCheck(String logFunction)
Enable runtime type checking, which adds JS type assertions for debugging.

Parameters:
logFunction - A JS function to be used for logging runtime type assertion failures.

disableRuntimeTypeCheck

public void disableRuntimeTypeCheck()

setGenerateExports

public void setGenerateExports(boolean generateExports)

setCodingConvention

public void setCodingConvention(CodingConvention codingConvention)

getCodingConvention

public CodingConvention getCodingConvention()

setManageClosureDependencies

public void setManageClosureDependencies(boolean newVal)
Sort inputs by their goog.provide/goog.require calls, and prune inputs whose symbols are not required.


setManageClosureDependencies

public void setManageClosureDependencies(List<String> entryPoints)
Sort inputs by their goog.provide/goog.require calls.

Parameters:
entryPoints - Entry points to the program. Must be goog.provide'd symbols. Any goog.provide'd symbols that are not a transitive dependency of the entry points will be deleted. Files without goog.provides, and their dependencies, will always be left in.

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, see --check_types), 3 (always print summary). The default level is 1


enableExternExports

public void enableExternExports(boolean enable)

isExternExportsEnabled

public boolean isExternExportsEnabled()

setOutputCharset

public void setOutputCharset(String charsetName)
Sets the output charset by name.


setTweakProcessing

public void setTweakProcessing(CompilerOptions.TweakProcessing tweakProcessing)
Sets how goog.tweak calls are processed.


getTweakProcessing

public CompilerOptions.TweakProcessing getTweakProcessing()

setLanguageIn

public void setLanguageIn(com.google.javascript.jscomp.CompilerOptions.LanguageMode languageIn)
Sets how goog.tweak calls are processed.


getLanguageIn

public com.google.javascript.jscomp.CompilerOptions.LanguageMode getLanguageIn()

getLanguageOut

public com.google.javascript.jscomp.CompilerOptions.LanguageMode getLanguageOut()

setLooseTypes

public void setLooseTypes(boolean looseTypes)
Whether to include "undefined" in the default types. For example: "{Object}" is normally "Object|null" becomes "Object|null|undefined" "{?string}" is normally "string|null" becomes "string|null|undefined" In either case "!" annotated types excluded both null and undefined.


clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

setAliasTransformationHandler

public void setAliasTransformationHandler(CompilerOptions.AliasTransformationHandler changes)

getAliasTransformationHandler

public CompilerOptions.AliasTransformationHandler getAliasTransformationHandler()