+ getEntryList();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry getEntry(int index);
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ int getEntryCount();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ List extends org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder>
+ getEntryOrBuilderList();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder getEntryOrBuilder(
+ int index);
+ }
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library}
+ *
+ *
+ * For Kotlin/Javascript we reuse builtins serialization code.
+ *
+ */
+ public static final class Library extends
+ GeneratedMessage
+ implements LibraryOrBuilder {
+ // Use Library.newBuilder() to construct.
+ private Library(GeneratedMessage.Builder> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Library(boolean noInit) { this.unknownFields = UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Library defaultInstance;
+ public static Library getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Library getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final UnknownFieldSet unknownFields;
+ @Override
+ public final UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Library(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ UnknownFieldSet.Builder unknownFields =
+ UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = new ArrayList();
+ mutable_bitField0_ |= 0x00000001;
+ }
+ entry_.add(input.readMessage(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.PARSER, extensionRegistry));
+ break;
+ }
+ }
+ }
+ } catch (InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (IOException e) {
+ throw new InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = Collections.unmodifiableList(entry_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final Descriptors.Descriptor
+ getDescriptor() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_descriptor;
+ }
+
+ protected GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.class, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.Builder.class);
+ }
+
+ public static Parser PARSER =
+ new AbstractParser() {
+ public Library parsePartialFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return new Library(input, extensionRegistry);
+ }
+ };
+
+ @Override
+ public Parser getParserForType() {
+ return PARSER;
+ }
+
+ public interface FileEntryOrBuilder
+ extends MessageOrBuilder {
+
+ // required string path = 1;
+ /**
+ * required string path = 1;
+ */
+ boolean hasPath();
+ /**
+ * required string path = 1;
+ */
+ String getPath();
+ /**
+ * required string path = 1;
+ */
+ ByteString
+ getPathBytes();
+
+ // required bytes content = 2;
+ /**
+ * required bytes content = 2;
+ */
+ boolean hasContent();
+ /**
+ * required bytes content = 2;
+ */
+ ByteString getContent();
+ }
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library.FileEntry}
+ */
+ public static final class FileEntry extends
+ GeneratedMessage
+ implements FileEntryOrBuilder {
+ // Use FileEntry.newBuilder() to construct.
+ private FileEntry(GeneratedMessage.Builder> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private FileEntry(boolean noInit) { this.unknownFields = UnknownFieldSet.getDefaultInstance(); }
+
+ private static final FileEntry defaultInstance;
+ public static FileEntry getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public FileEntry getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final UnknownFieldSet unknownFields;
+ @Override
+ public final UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private FileEntry(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ UnknownFieldSet.Builder unknownFields =
+ UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ path_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ content_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (IOException e) {
+ throw new InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final Descriptors.Descriptor
+ getDescriptor() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor;
+ }
+
+ protected GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.class, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder.class);
+ }
+
+ public static Parser PARSER =
+ new AbstractParser() {
+ public FileEntry parsePartialFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return new FileEntry(input, extensionRegistry);
+ }
+ };
+
+ @Override
+ public Parser getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string path = 1;
+ public static final int PATH_FIELD_NUMBER = 1;
+ private Object path_;
+ /**
+ * required string path = 1;
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string path = 1;
+ */
+ public String getPath() {
+ Object ref = path_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ ByteString bs =
+ (ByteString) ref;
+ String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ path_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string path = 1;
+ */
+ public ByteString
+ getPathBytes() {
+ Object ref = path_;
+ if (ref instanceof String) {
+ ByteString b =
+ ByteString.copyFromUtf8(
+ (String) ref);
+ path_ = b;
+ return b;
+ } else {
+ return (ByteString) ref;
+ }
+ }
+
+ // required bytes content = 2;
+ public static final int CONTENT_FIELD_NUMBER = 2;
+ private ByteString content_;
+ /**
+ * required bytes content = 2;
+ */
+ public boolean hasContent() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public ByteString getContent() {
+ return content_;
+ }
+
+ private void initFields() {
+ path_ = "";
+ content_ = ByteString.EMPTY;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasContent()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(CodedOutputStream output)
+ throws IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, content_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += CodedOutputStream
+ .computeBytesSize(1, getPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += CodedOutputStream
+ .computeBytesSize(2, content_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @Override
+ protected Object writeReplace()
+ throws ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(
+ ByteString data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(
+ ByteString data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(byte[] data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(
+ byte[] data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseDelimitedFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseDelimitedFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(
+ CodedInputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parseFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @Override
+ protected Builder newBuilderForType(
+ GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library.FileEntry}
+ */
+ public static final class Builder extends
+ GeneratedMessage.Builder
+ implements org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder {
+ public static final Descriptors.Descriptor
+ getDescriptor() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor;
+ }
+
+ protected GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.class, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder.class);
+ }
+
+ // Construct using org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ path_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ content_ = ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor;
+ }
+
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry getDefaultInstanceForType() {
+ return getDefaultInstance();
+ }
+
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry build() {
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry buildPartial() {
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry result = new org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.path_ = path_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.content_ = content_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(Message other) {
+ if (other instanceof org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry) {
+ return mergeFrom((org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry other) {
+ if (other == getDefaultInstance()) return this;
+ if (other.hasPath()) {
+ bitField0_ |= 0x00000001;
+ path_ = other.path_;
+ onChanged();
+ }
+ if (other.hasContent()) {
+ setContent(other.getContent());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasPath()) {
+
+ return false;
+ }
+ if (!hasContent()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (InvalidProtocolBufferException e) {
+ parsedMessage = (org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string path = 1;
+ private Object path_ = "";
+ /**
+ * required string path = 1;
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string path = 1;
+ */
+ public String getPath() {
+ Object ref = path_;
+ if (!(ref instanceof String)) {
+ String s = ((ByteString) ref)
+ .toStringUtf8();
+ path_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+ /**
+ * required string path = 1;
+ */
+ public ByteString
+ getPathBytes() {
+ Object ref = path_;
+ if (ref instanceof String) {
+ ByteString b =
+ ByteString.copyFromUtf8(
+ (String) ref);
+ path_ = b;
+ return b;
+ } else {
+ return (ByteString) ref;
+ }
+ }
+ /**
+ * required string path = 1;
+ */
+ public Builder setPath(
+ String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ path_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required string path = 1;
+ */
+ public Builder clearPath() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ path_ = getDefaultInstance().getPath();
+ onChanged();
+ return this;
+ }
+ /**
+ * required string path = 1;
+ */
+ public Builder setPathBytes(
+ ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ path_ = value;
+ onChanged();
+ return this;
+ }
+
+ // required bytes content = 2;
+ private ByteString content_ = ByteString.EMPTY;
+ /**
+ * required bytes content = 2;
+ */
+ public boolean hasContent() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public ByteString getContent() {
+ return content_;
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public Builder setContent(ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ content_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public Builder clearContent() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ content_ = getDefaultInstance().getContent();
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.Library.FileEntry)
+ }
+
+ static {
+ defaultInstance = new FileEntry(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.js.Library.FileEntry)
+ }
+
+ // repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ public static final int ENTRY_FIELD_NUMBER = 1;
+ private List entry_;
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List getEntryList() {
+ return entry_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List extends org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder>
+ getEntryOrBuilderList() {
+ return entry_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public int getEntryCount() {
+ return entry_.size();
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry getEntry(int index) {
+ return entry_.get(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder getEntryOrBuilder(
+ int index) {
+ return entry_.get(index);
+ }
+
+ private void initFields() {
+ entry_ = Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getEntryCount(); i++) {
+ if (!getEntry(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(CodedOutputStream output)
+ throws IOException {
+ getSerializedSize();
+ for (int i = 0; i < entry_.size(); i++) {
+ output.writeMessage(1, entry_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ for (int i = 0; i < entry_.size(); i++) {
+ size += CodedOutputStream
+ .computeMessageSize(1, entry_.get(i));
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @Override
+ protected Object writeReplace()
+ throws ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(
+ ByteString data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(
+ ByteString data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(byte[] data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(
+ byte[] data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseDelimitedFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseDelimitedFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(
+ CodedInputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parseFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @Override
+ protected Builder newBuilderForType(
+ GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library}
+ *
+ *
+ * For Kotlin/Javascript we reuse builtins serialization code.
+ *
+ */
+ public static final class Builder extends
+ GeneratedMessage.Builder
+ implements org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.LibraryOrBuilder {
+ public static final Descriptors.Descriptor
+ getDescriptor() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_descriptor;
+ }
+
+ protected GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.class, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.Builder.class);
+ }
+
+ // Construct using org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (GeneratedMessage.alwaysUseFieldBuilders) {
+ getEntryFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ if (entryBuilder_ == null) {
+ entry_ = Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ entryBuilder_.clear();
+ }
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.internal_static_org_jetbrains_kotlin_serialization_js_Library_descriptor;
+ }
+
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library getDefaultInstanceForType() {
+ return getDefaultInstance();
+ }
+
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library build() {
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library buildPartial() {
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library result = new org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library(this);
+ int from_bitField0_ = bitField0_;
+ if (entryBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = Collections.unmodifiableList(entry_);
+ bitField0_ = (bitField0_ & ~0x00000001);
+ }
+ result.entry_ = entry_;
+ } else {
+ result.entry_ = entryBuilder_.build();
+ }
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(Message other) {
+ if (other instanceof org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library) {
+ return mergeFrom((org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library other) {
+ if (other == getDefaultInstance()) return this;
+ if (entryBuilder_ == null) {
+ if (!other.entry_.isEmpty()) {
+ if (entry_.isEmpty()) {
+ entry_ = other.entry_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ ensureEntryIsMutable();
+ entry_.addAll(other.entry_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.entry_.isEmpty()) {
+ if (entryBuilder_.isEmpty()) {
+ entryBuilder_.dispose();
+ entryBuilder_ = null;
+ entry_ = other.entry_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ entryBuilder_ =
+ GeneratedMessage.alwaysUseFieldBuilders ?
+ getEntryFieldBuilder() : null;
+ } else {
+ entryBuilder_.addAllMessages(other.entry_);
+ }
+ }
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ for (int i = 0; i < getEntryCount(); i++) {
+ if (!getEntry(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (InvalidProtocolBufferException e) {
+ parsedMessage = (org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ private List entry_ =
+ Collections.emptyList();
+ private void ensureEntryIsMutable() {
+ if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = new ArrayList(entry_);
+ bitField0_ |= 0x00000001;
+ }
+ }
+
+ private RepeatedFieldBuilder<
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder> entryBuilder_;
+
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List getEntryList() {
+ if (entryBuilder_ == null) {
+ return Collections.unmodifiableList(entry_);
+ } else {
+ return entryBuilder_.getMessageList();
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public int getEntryCount() {
+ if (entryBuilder_ == null) {
+ return entry_.size();
+ } else {
+ return entryBuilder_.getCount();
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry getEntry(int index) {
+ if (entryBuilder_ == null) {
+ return entry_.get(index);
+ } else {
+ return entryBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder setEntry(
+ int index, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry value) {
+ if (entryBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureEntryIsMutable();
+ entry_.set(index, value);
+ onChanged();
+ } else {
+ entryBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder setEntry(
+ int index, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder builderForValue) {
+ if (entryBuilder_ == null) {
+ ensureEntryIsMutable();
+ entry_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ entryBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry value) {
+ if (entryBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureEntryIsMutable();
+ entry_.add(value);
+ onChanged();
+ } else {
+ entryBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(
+ int index, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry value) {
+ if (entryBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureEntryIsMutable();
+ entry_.add(index, value);
+ onChanged();
+ } else {
+ entryBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder builderForValue) {
+ if (entryBuilder_ == null) {
+ ensureEntryIsMutable();
+ entry_.add(builderForValue.build());
+ onChanged();
+ } else {
+ entryBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(
+ int index, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder builderForValue) {
+ if (entryBuilder_ == null) {
+ ensureEntryIsMutable();
+ entry_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ entryBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addAllEntry(
+ Iterable extends org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry> values) {
+ if (entryBuilder_ == null) {
+ ensureEntryIsMutable();
+ addAll(values, entry_);
+ onChanged();
+ } else {
+ entryBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder clearEntry() {
+ if (entryBuilder_ == null) {
+ entry_ = Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ onChanged();
+ } else {
+ entryBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder removeEntry(int index) {
+ if (entryBuilder_ == null) {
+ ensureEntryIsMutable();
+ entry_.remove(index);
+ onChanged();
+ } else {
+ entryBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder getEntryBuilder(
+ int index) {
+ return getEntryFieldBuilder().getBuilder(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder getEntryOrBuilder(
+ int index) {
+ if (entryBuilder_ == null) {
+ return entry_.get(index); } else {
+ return entryBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List extends org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder>
+ getEntryOrBuilderList() {
+ if (entryBuilder_ != null) {
+ return entryBuilder_.getMessageOrBuilderList();
+ } else {
+ return Collections.unmodifiableList(entry_);
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder addEntryBuilder() {
+ return getEntryFieldBuilder().addBuilder(
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.getDefaultInstance());
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder addEntryBuilder(
+ int index) {
+ return getEntryFieldBuilder().addBuilder(
+ index, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.getDefaultInstance());
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List
+ getEntryBuilderList() {
+ return getEntryFieldBuilder().getBuilderList();
+ }
+ private RepeatedFieldBuilder<
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder>
+ getEntryFieldBuilder() {
+ if (entryBuilder_ == null) {
+ entryBuilder_ = new RepeatedFieldBuilder<
+ org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntry.Builder, org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.Library.FileEntryOrBuilder>(
+ entry_,
+ ((bitField0_ & 0x00000001) == 0x00000001),
+ getParentForChildren(),
+ isClean());
+ entry_ = null;
+ }
+ return entryBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.Library)
+ }
+
+ static {
+ defaultInstance = new Library(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.js.Library)
+ }
+
+ private static Descriptors.Descriptor
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_descriptor;
+ private static
+ GeneratedMessage.FieldAccessorTable
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_fieldAccessorTable;
+ private static Descriptors.Descriptor
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor;
+ private static
+ GeneratedMessage.FieldAccessorTable
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_fieldAccessorTable;
+
+ public static Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static Descriptors.FileDescriptor
+ descriptor;
+ static {
+ String[] descriptorData = {
+ "\n(core/serialization.js/src/js.debug.pro" +
+ "to\022%org.jetbrains.kotlin.serialization.j" +
+ "s\"~\n\007Library\022G\n\005entry\030\001 \003(\01328.org.jetbra" +
+ "ins.kotlin.serialization.js.Library.File" +
+ "Entry\032*\n\tFileEntry\022\014\n\004path\030\001 \002(\t\022\017\n\007cont" +
+ "ent\030\002 \002(\014B\021B\017DebugJsProtoBuf"
+ };
+ Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public ExtensionRegistry assignDescriptors(
+ Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_fieldAccessorTable = new
+ GeneratedMessage.FieldAccessorTable(
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_descriptor,
+ new String[] { "Entry", });
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor =
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_descriptor.getNestedTypes().get(0);
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_fieldAccessorTable = new
+ GeneratedMessage.FieldAccessorTable(
+ internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor,
+ new String[] { "Path", "Content", });
+ return null;
+ }
+ };
+ Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/core/serialization.js/serialization.js.iml b/core/serialization.js/serialization.js.iml
new file mode 100644
index 00000000000..1e5af8fbb69
--- /dev/null
+++ b/core/serialization.js/serialization.js.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/serialization.js/src/js.proto b/core/serialization.js/src/js.proto
new file mode 100644
index 00000000000..dcb29d588af
--- /dev/null
+++ b/core/serialization.js/src/js.proto
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2010-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.serialization.js;
+
+option java_outer_classname = "JsProtoBuf";
+option optimize_for = LITE_RUNTIME;
+
+// For Kotlin/Javascript we reuse builtins serialization code.
+message Library {
+ message FileEntry {
+ required string path = 1;
+ required bytes content = 2;
+ }
+
+ repeated FileEntry entry = 1;
+}
diff --git a/core/serialization.js/src/org/jetbrains/kotlin/serialization/js/JsProtoBuf.java b/core/serialization.js/src/org/jetbrains/kotlin/serialization/js/JsProtoBuf.java
new file mode 100644
index 00000000000..8c982affd4f
--- /dev/null
+++ b/core/serialization.js/src/org/jetbrains/kotlin/serialization/js/JsProtoBuf.java
@@ -0,0 +1,1014 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: core/serialization.js/src/js.proto
+
+package org.jetbrains.kotlin.serialization.js;
+
+import com.google.protobuf.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectStreamException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public final class JsProtoBuf {
+ private JsProtoBuf() {}
+ public static void registerAllExtensions(
+ ExtensionRegistryLite registry) {
+ }
+ public interface LibraryOrBuilder
+ extends MessageLiteOrBuilder {
+
+ // repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ List
+ getEntryList();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry getEntry(int index);
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ int getEntryCount();
+ }
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library}
+ *
+ *
+ * For Kotlin/Javascript we reuse builtins serialization code.
+ *
+ */
+ public static final class Library extends
+ GeneratedMessageLite
+ implements LibraryOrBuilder {
+ // Use Library.newBuilder() to construct.
+ private Library(GeneratedMessageLite.Builder builder) {
+ super(builder);
+
+ }
+ private Library(boolean noInit) {}
+
+ private static final Library defaultInstance;
+ public static Library getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Library getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private Library(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = new ArrayList();
+ mutable_bitField0_ |= 0x00000001;
+ }
+ entry_.add(input.readMessage(org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry.PARSER, extensionRegistry));
+ break;
+ }
+ }
+ }
+ } catch (InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (IOException e) {
+ throw new InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = Collections.unmodifiableList(entry_);
+ }
+ makeExtensionsImmutable();
+ }
+ }
+ public static Parser PARSER =
+ new AbstractParser() {
+ public Library parsePartialFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return new Library(input, extensionRegistry);
+ }
+ };
+
+ @Override
+ public Parser getParserForType() {
+ return PARSER;
+ }
+
+ public interface FileEntryOrBuilder
+ extends MessageLiteOrBuilder {
+
+ // required string path = 1;
+ /**
+ * required string path = 1;
+ */
+ boolean hasPath();
+ /**
+ * required string path = 1;
+ */
+ String getPath();
+ /**
+ * required string path = 1;
+ */
+ ByteString
+ getPathBytes();
+
+ // required bytes content = 2;
+ /**
+ * required bytes content = 2;
+ */
+ boolean hasContent();
+ /**
+ * required bytes content = 2;
+ */
+ ByteString getContent();
+ }
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library.FileEntry}
+ */
+ public static final class FileEntry extends
+ GeneratedMessageLite
+ implements FileEntryOrBuilder {
+ // Use FileEntry.newBuilder() to construct.
+ private FileEntry(GeneratedMessageLite.Builder builder) {
+ super(builder);
+
+ }
+ private FileEntry(boolean noInit) {}
+
+ private static final FileEntry defaultInstance;
+ public static FileEntry getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public FileEntry getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private FileEntry(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ path_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ content_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (IOException e) {
+ throw new InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ makeExtensionsImmutable();
+ }
+ }
+ public static Parser PARSER =
+ new AbstractParser() {
+ public FileEntry parsePartialFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return new FileEntry(input, extensionRegistry);
+ }
+ };
+
+ @Override
+ public Parser getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string path = 1;
+ public static final int PATH_FIELD_NUMBER = 1;
+ private Object path_;
+ /**
+ * required string path = 1;
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string path = 1;
+ */
+ public String getPath() {
+ Object ref = path_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ ByteString bs =
+ (ByteString) ref;
+ String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ path_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string path = 1;
+ */
+ public ByteString
+ getPathBytes() {
+ Object ref = path_;
+ if (ref instanceof String) {
+ ByteString b =
+ ByteString.copyFromUtf8(
+ (String) ref);
+ path_ = b;
+ return b;
+ } else {
+ return (ByteString) ref;
+ }
+ }
+
+ // required bytes content = 2;
+ public static final int CONTENT_FIELD_NUMBER = 2;
+ private ByteString content_;
+ /**
+ * required bytes content = 2;
+ */
+ public boolean hasContent() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public ByteString getContent() {
+ return content_;
+ }
+
+ private void initFields() {
+ path_ = "";
+ content_ = ByteString.EMPTY;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasContent()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(CodedOutputStream output)
+ throws IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, content_);
+ }
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += CodedOutputStream
+ .computeBytesSize(1, getPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += CodedOutputStream
+ .computeBytesSize(2, content_);
+ }
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @Override
+ protected Object writeReplace()
+ throws ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(
+ ByteString data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(
+ ByteString data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(byte[] data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(
+ byte[] data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseDelimitedFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseDelimitedFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(
+ CodedInputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parseFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library.FileEntry}
+ */
+ public static final class Builder extends
+ GeneratedMessageLite.Builder<
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry, Builder>
+ implements org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntryOrBuilder {
+ // Construct using org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private void maybeForceBuilderInitialization() {
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ path_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ content_ = ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry getDefaultInstanceForType() {
+ return getDefaultInstance();
+ }
+
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry build() {
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry buildPartial() {
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry result = new org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.path_ = path_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.content_ = content_;
+ result.bitField0_ = to_bitField0_;
+ return result;
+ }
+
+ public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry other) {
+ if (other == getDefaultInstance()) return this;
+ if (other.hasPath()) {
+ bitField0_ |= 0x00000001;
+ path_ = other.path_;
+
+ }
+ if (other.hasContent()) {
+ setContent(other.getContent());
+ }
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasPath()) {
+
+ return false;
+ }
+ if (!hasContent()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (InvalidProtocolBufferException e) {
+ parsedMessage = (org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string path = 1;
+ private Object path_ = "";
+ /**
+ * required string path = 1;
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string path = 1;
+ */
+ public String getPath() {
+ Object ref = path_;
+ if (!(ref instanceof String)) {
+ String s = ((ByteString) ref)
+ .toStringUtf8();
+ path_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+ /**
+ * required string path = 1;
+ */
+ public ByteString
+ getPathBytes() {
+ Object ref = path_;
+ if (ref instanceof String) {
+ ByteString b =
+ ByteString.copyFromUtf8(
+ (String) ref);
+ path_ = b;
+ return b;
+ } else {
+ return (ByteString) ref;
+ }
+ }
+ /**
+ * required string path = 1;
+ */
+ public Builder setPath(
+ String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ path_ = value;
+
+ return this;
+ }
+ /**
+ * required string path = 1;
+ */
+ public Builder clearPath() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ path_ = getDefaultInstance().getPath();
+
+ return this;
+ }
+ /**
+ * required string path = 1;
+ */
+ public Builder setPathBytes(
+ ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ path_ = value;
+
+ return this;
+ }
+
+ // required bytes content = 2;
+ private ByteString content_ = ByteString.EMPTY;
+ /**
+ * required bytes content = 2;
+ */
+ public boolean hasContent() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public ByteString getContent() {
+ return content_;
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public Builder setContent(ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ content_ = value;
+
+ return this;
+ }
+ /**
+ * required bytes content = 2;
+ */
+ public Builder clearContent() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ content_ = getDefaultInstance().getContent();
+
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.Library.FileEntry)
+ }
+
+ static {
+ defaultInstance = new FileEntry(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.js.Library.FileEntry)
+ }
+
+ // repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ public static final int ENTRY_FIELD_NUMBER = 1;
+ private List entry_;
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List getEntryList() {
+ return entry_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List extends org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntryOrBuilder>
+ getEntryOrBuilderList() {
+ return entry_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public int getEntryCount() {
+ return entry_.size();
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry getEntry(int index) {
+ return entry_.get(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntryOrBuilder getEntryOrBuilder(
+ int index) {
+ return entry_.get(index);
+ }
+
+ private void initFields() {
+ entry_ = Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getEntryCount(); i++) {
+ if (!getEntry(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(CodedOutputStream output)
+ throws IOException {
+ getSerializedSize();
+ for (int i = 0; i < entry_.size(); i++) {
+ output.writeMessage(1, entry_.get(i));
+ }
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ for (int i = 0; i < entry_.size(); i++) {
+ size += CodedOutputStream
+ .computeMessageSize(1, entry_.get(i));
+ }
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @Override
+ protected Object writeReplace()
+ throws ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(
+ ByteString data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(
+ ByteString data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(byte[] data)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(
+ byte[] data,
+ ExtensionRegistryLite extensionRegistry)
+ throws InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseDelimitedFrom(InputStream input)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseDelimitedFrom(
+ InputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(
+ CodedInputStream input)
+ throws IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parseFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ /**
+ * Protobuf type {@code org.jetbrains.kotlin.serialization.js.Library}
+ *
+ *
+ * For Kotlin/Javascript we reuse builtins serialization code.
+ *
+ */
+ public static final class Builder extends
+ GeneratedMessageLite.Builder<
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library, Builder>
+ implements org.jetbrains.kotlin.serialization.js.JsProtoBuf.LibraryOrBuilder {
+ // Construct using org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private void maybeForceBuilderInitialization() {
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ entry_ = Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library getDefaultInstanceForType() {
+ return getDefaultInstance();
+ }
+
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library build() {
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library buildPartial() {
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library result = new org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library(this);
+ int from_bitField0_ = bitField0_;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = Collections.unmodifiableList(entry_);
+ bitField0_ = (bitField0_ & ~0x00000001);
+ }
+ result.entry_ = entry_;
+ return result;
+ }
+
+ public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library other) {
+ if (other == getDefaultInstance()) return this;
+ if (!other.entry_.isEmpty()) {
+ if (entry_.isEmpty()) {
+ entry_ = other.entry_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ ensureEntryIsMutable();
+ entry_.addAll(other.entry_);
+ }
+
+ }
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ for (int i = 0; i < getEntryCount(); i++) {
+ if (!getEntry(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ CodedInputStream input,
+ ExtensionRegistryLite extensionRegistry)
+ throws IOException {
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (InvalidProtocolBufferException e) {
+ parsedMessage = (org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ private List entry_ =
+ Collections.emptyList();
+ private void ensureEntryIsMutable() {
+ if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+ entry_ = new ArrayList(entry_);
+ bitField0_ |= 0x00000001;
+ }
+ }
+
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public List getEntryList() {
+ return Collections.unmodifiableList(entry_);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public int getEntryCount() {
+ return entry_.size();
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry getEntry(int index) {
+ return entry_.get(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder setEntry(
+ int index, org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureEntryIsMutable();
+ entry_.set(index, value);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder setEntry(
+ int index, org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry.Builder builderForValue) {
+ ensureEntryIsMutable();
+ entry_.set(index, builderForValue.build());
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureEntryIsMutable();
+ entry_.add(value);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(
+ int index, org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureEntryIsMutable();
+ entry_.add(index, value);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(
+ org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry.Builder builderForValue) {
+ ensureEntryIsMutable();
+ entry_.add(builderForValue.build());
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addEntry(
+ int index, org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry.Builder builderForValue) {
+ ensureEntryIsMutable();
+ entry_.add(index, builderForValue.build());
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder addAllEntry(
+ Iterable extends org.jetbrains.kotlin.serialization.js.JsProtoBuf.Library.FileEntry> values) {
+ ensureEntryIsMutable();
+ addAll(values, entry_);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder clearEntry() {
+ entry_ = Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.js.Library.FileEntry entry = 1;
+ */
+ public Builder removeEntry(int index) {
+ ensureEntryIsMutable();
+ entry_.remove(index);
+
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.Library)
+ }
+
+ static {
+ defaultInstance = new Library(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.js.Library)
+ }
+
+
+ static {
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/core/serialization.js/src/org/jetbrains/kotlin/serialization/js/KotlinJavascriptSerializationUtil.kt b/core/serialization.js/src/org/jetbrains/kotlin/serialization/js/KotlinJavascriptSerializationUtil.kt
new file mode 100644
index 00000000000..e8a027611fa
--- /dev/null
+++ b/core/serialization.js/src/org/jetbrains/kotlin/serialization/js/KotlinJavascriptSerializationUtil.kt
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2010-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.serialization.js
+
+import com.google.protobuf.ByteString
+import org.jetbrains.kotlin.builtins.BuiltinsPackageFragment
+import org.jetbrains.kotlin.descriptors.ModuleDescriptor
+import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
+import org.jetbrains.kotlin.name.FqName
+import org.jetbrains.kotlin.serialization.deserialization.FlexibleTypeCapabilitiesDeserializer
+import org.jetbrains.kotlin.storage.LockBasedStorageManager
+import java.io.ByteArrayInputStream
+import java.io.ByteArrayOutputStream
+import java.util.zip.GZIPInputStream
+import java.util.zip.GZIPOutputStream
+import kotlin.platform.platformStatic
+
+public object KotlinJavascriptSerializationUtil {
+ private val PACKAGE_FILE_SUFFIX = "/.kotlin_package"
+
+ platformStatic
+ public fun getPackageFragmentProviders(moduleDescriptor: ModuleDescriptor, metadata: ByteArray): List {
+ val gzipInputStream = GZIPInputStream(ByteArrayInputStream(metadata))
+ val content = JsProtoBuf.Library.parseFrom(gzipInputStream)
+ gzipInputStream.close()
+
+ val contentMap: MutableMap = hashMapOf()
+ for(index in 0..content.getEntryCount()-1) {
+ val entry = content.getEntry(index)
+ contentMap[entry.getPath()] = entry.getContent().toByteArray()
+ }
+
+ val packages = getPackages(contentMap)
+
+ val load = { (path: String) -> if (!contentMap.containsKey(path)) null else ByteArrayInputStream(contentMap.get(path)) }
+
+ val providers = arrayListOf()
+ for (packageName in packages) {
+ val fqName = FqName(packageName)
+ val packageFragment = BuiltinsPackageFragment(fqName, LockBasedStorageManager(), moduleDescriptor, FlexibleTypeCapabilitiesDeserializer.Dynamic, load)
+ providers.add(packageFragment.provider)
+ }
+
+ return providers
+ }
+
+ public fun contentMapToByteArray(contentMap: Map): ByteArray {
+ val contentBuilder = JsProtoBuf.Library.newBuilder()
+ contentMap forEach {
+ val entry = JsProtoBuf.Library.FileEntry.newBuilder().setPath(it.getKey()).setContent(ByteString.copyFrom(it.getValue())).build()
+ contentBuilder.addEntry(entry)
+ }
+
+ val byteStream = ByteArrayOutputStream()
+ val gzipOutputStream = GZIPOutputStream(byteStream)
+ contentBuilder.build().writeTo(gzipOutputStream)
+ gzipOutputStream.close()
+
+ return byteStream.toByteArray()
+ }
+
+ private fun getPackages(contentMap: Map): List =
+ contentMap.keySet().filter { it.endsWith(PACKAGE_FILE_SUFFIX) } map { it.substring(0, it.length() - PACKAGE_FILE_SUFFIX.length()).replace('/', '.') }
+}
\ No newline at end of file
diff --git a/generators/src/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBuf.kt b/generators/src/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBuf.kt
index d7d819ca319..704e4334e75 100644
--- a/generators/src/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBuf.kt
+++ b/generators/src/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBuf.kt
@@ -51,6 +51,7 @@ public data class ProtoPath(
public val PROTO_PATHS: List = listOf(
ProtoPath("core/serialization/src/descriptors.proto", "core/serialization/src"),
ProtoPath("core/serialization/src/builtins.proto", "core/serialization/src"),
+ ProtoPath("core/serialization.js/src/js.proto", "core/serialization.js/src"),
ProtoPath("core/serialization.jvm/src/jvm_descriptors.proto", "core/serialization.jvm/src")
)