this.level = Args.notNull(level, "level");
}
@Override
public String compress(final String original) {
final Compiler compiler = new Compiler();
// Advanced mode is used here, but additional options could be set, too.
CompilerOptions options = new CompilerOptions();
level.setOptionsForCompilationLevel(options);
overrideOptions(options);
final SourceFile extern = getExterns();
// The dummy input name "input.js" is used here so that any warnings or
// errors will cite line numbers in terms of input.js.
final SourceFile input = SourceFile.fromCode("input.js", original);
// compile() returns a Result, but it is not needed here.
compiler.compile(extern, input, options);
// The compiler is responsible for generating the compiled code; it is not
// accessible via the Result.
return compiler.toSource();
}