Enum CompilationLevel

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CompilationLevel>

    public enum CompilationLevel
    extends java.lang.Enum<CompilationLevel>
    A CompilationLevel represents the level of optimization that should be applied when compiling JavaScript code.
    • Enum Constant Detail

      • WHITESPACE_ONLY

        public static final CompilationLevel WHITESPACE_ONLY
        WHITESPACE_ONLY removes comments and extra whitespace in the input JS.
      • SIMPLE_OPTIMIZATIONS

        public static final CompilationLevel SIMPLE_OPTIMIZATIONS
        SIMPLE_OPTIMIZATIONS performs transformations to the input JS that do not require any changes to JS that depend on the input JS. For example, function arguments are renamed (which should not matter to code that depends on the input JS), but functions themselves are not renamed (which would otherwise require external code to change to use the renamed function names).
      • ADVANCED_OPTIMIZATIONS

        public static final CompilationLevel ADVANCED_OPTIMIZATIONS
        ADVANCED_OPTIMIZATIONS aggressively reduces code size by renaming function names and variables, removing code which is never called, etc.
    • Method Detail

      • values

        public static CompilationLevel[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CompilationLevel c : CompilationLevel.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CompilationLevel valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • setOptionsForCompilationLevel

        public void setOptionsForCompilationLevel​(CompilerOptions options)
      • setDebugOptionsForCompilationLevel

        public void setDebugOptionsForCompilationLevel​(CompilerOptions options)
      • setTypeBasedOptimizationOptions

        public void setTypeBasedOptimizationOptions​(CompilerOptions options)
        Enable additional optimizations that use type information.
        Parameters:
        options - The CompilerOptions object to set the options on.