code: private static JavaScriptObject[] toNativeErrorArray(List<JSError> errors) {
      JavaScriptObject[] out = new JavaScriptObject[errors.size()];
      for (int i = 0; i < errors.size(); ++i) {
        JSError error = errors.get(i);
        DiagnosticType type = error.getType();
        out[i] = createError(error.sourceName, error.description, type != null ? type.key : null,
            error.lineNumber, error.getCharno());
      }
      return out;
    }
docs: Convert a list of {@link JSError} instances to a JS array containing plain objects.