code: public <T extends SourceFile> Collection<JsMessage> extractMessages(Iterable<T> inputs) {
      final Compiler compiler = new Compiler();
      compiler.init(
          ImmutableList.<SourceFile>of(),
          ImmutableList.copyOf(inputs),
          options);
      compiler.runInCompilerThread(
          () -> {
            compiler.parseInputs();
            return null;
          });
  
      ExtractMessagesVisitor extractCompilerPass =
          new ExtractMessagesVisitor(compiler);
      if (compiler.getErrors().isEmpty()) {
        extractCompilerPass.process(null, compiler.getRoot());
      }
  
      ImmutableList<JSError> errors = compiler.getErrors();
      // Check for errors.
      if (!errors.isEmpty()) {
        StringBuilder msg = new StringBuilder("JSCompiler errors\n");
        MessageFormatter formatter = new LightweightMessageFormatter(compiler);
        for (JSError e : errors) {
          msg.append(formatter.formatError(e));
        }
        throw new RuntimeException(msg.toString());
      }
  
      return extractCompilerPass.getMessages();
    }
docs: Extracts JS messages from JavaScript code.
  
  @param inputs  the JavaScript source code inputs
  @return the extracted messages collection
  @throws RuntimeException if there are problems parsing the JS code or the
  JS messages, or if two messages have the same key