Class AbstractCommandLineCompiler<T extends JobDescription>

java.lang.Object
com.google.common.css.AbstractCommandLineCompiler<T>
Direct Known Subclasses:
DefaultCommandLineCompiler

public class AbstractCommandLineCompiler<T extends JobDescription> extends Object
An abstract class that is designed to be extended by classes that provide a command line interface to the CSS parser.
  • Field Details

    • SUCCESS_EXIT_CODE

      public static final int SUCCESS_EXIT_CODE
      Exit code for success (normal operation of the compiler, possibly with warnings and informational messages, but with no errors whatsoever).
      See Also:
    • ERROR_MESSAGE_EXIT_CODE

      public static final int ERROR_MESSAGE_EXIT_CODE
      Exit code for compilation errors. The compiler processed the input normally, but the input was wrong in some way.
      See Also:
    • UNHANDLED_EXCEPTION_EXIT_CODE

      public static final int UNHANDLED_EXCEPTION_EXIT_CODE
      Exit code for unhandled exceptions (such as IOException).
      See Also:
    • INTERNAL_ERROR_EXIT_CODE

      public static final int INTERNAL_ERROR_EXIT_CODE
      Exit code for abnormal compiler behavior, such as violated invariants, infinite loops and the likes.
      See Also:
    • job

      protected final T extends JobDescription job
      The job to process: the inputs and the options.
    • compilerWasUsed

      protected boolean compilerWasUsed
      Whether the compiler was called. We don't allow calling it twice.
    • exitCodeHandler

      protected final ExitCodeHandler exitCodeHandler
      Used to manage calls to System.exit().
  • Constructor Details

    • AbstractCommandLineCompiler

      public AbstractCommandLineCompiler(T job, ExitCodeHandler exitCodeHandler)
      Constructs an AbstractCommandLineCompiler.
      Parameters:
      job - the inputs the compiler should process and the options to use
  • Method Details

    • exitOnUnhandledException

      protected static void exitOnUnhandledException(Exception e, ExitCodeHandler exitCodeHandler)
      Prints a message announcing an unhandled exception and exits.