From b20af31e94108ba2b6e98ab0f77dbe7cbd43cf70 Mon Sep 17 00:00:00 2001 From: Christophe Le Saec Date: Wed, 12 Jul 2023 16:34:33 +0200 Subject: [PATCH] AVRO-1827: protobuf --- .../apache/avro/protobuf/ProtobufData.java | 72 +- .../apache/avro/protobuf/TestProtobuf.java | 77 ++ .../apache/avro/protobuf/multiplefiles/A.java | 6 + .../avro/protobuf/multiplefiles/Foo.java | 866 ++++++++---- .../protobuf/multiplefiles/FooOrBuilder.java | 88 ++ .../apache/avro/protobuf/multiplefiles/M.java | 55 +- .../multiplefiles/TestMultipleFiles.java | 12 +- .../org/apache/avro/protobuf/noopt/Test.java | 1170 +++++++++++++---- .../protobuf/src/test/protobuf/test.proto | 3 +- .../test/protobuf/test_multiple_files.proto | 2 +- 10 files changed, 1836 insertions(+), 515 deletions(-) diff --git a/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java b/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java index ca4d78b6026..36518ee1cc0 100644 --- a/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java +++ b/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java @@ -35,6 +35,7 @@ import org.apache.avro.io.DatumReader; import org.apache.avro.io.DatumWriter; +import com.fasterxml.jackson.databind.node.NullNode; import com.google.protobuf.ByteString; import com.google.protobuf.Message; import com.google.protobuf.Message.Builder; @@ -87,15 +88,11 @@ public Object getField(Object r, String name, int pos) { @Override protected void setField(Object record, String name, int position, Object value, Object state) { - Builder b = (Builder) record; - FieldDescriptor f = ((FieldDescriptor[]) state)[position]; - switch (f.getType()) { - case MESSAGE: - if (value == null) { - b.clearField(f); - break; - } - default: + final Builder b = (Builder) record; + final FieldDescriptor f = ((FieldDescriptor[]) state)[position]; + if (value == null) { + b.clearField(f); + } else { b.setField(f, value); } } @@ -104,11 +101,9 @@ protected void setField(Object record, String name, int position, Object value, protected Object getField(Object record, String name, int pos, Object state) { Message m = (Message) record; FieldDescriptor f = ((FieldDescriptor[]) state)[pos]; - switch (f.getType()) { - case MESSAGE: - if (!f.isRepeated() && !m.hasField(f)) - return null; - default: + if (!f.isRepeated() && !m.hasField(f) && !f.hasDefaultValue()) { + return null; + } else { return m.getField(f); } } @@ -133,6 +128,11 @@ protected boolean isRecord(Object datum) { return datum instanceof Message; } + @Override + protected boolean isEnum(final Object datum) { + return datum instanceof EnumValueDescriptor; + } + @Override public Object newRecord(Object old, Schema schema) { try { @@ -148,6 +148,11 @@ public Object newRecord(Object old, Schema schema) { } } + @Override + protected Schema getEnumSchema(final Object enumObj) { + return getSchema(((EnumValueDescriptor) enumObj).getType()); + } + @Override protected boolean isArray(Object datum) { return datum instanceof List; @@ -274,46 +279,57 @@ public Schema getSchema(FieldDescriptor f) { } private Schema getNonRepeatedSchema(FieldDescriptor f) { - Schema result; switch (f.getType()) { case BOOL: - return Schema.create(Schema.Type.BOOLEAN); + return getSchema(Schema.create(Schema.Type.BOOLEAN), f); case FLOAT: - return Schema.create(Schema.Type.FLOAT); + return getSchema(Schema.create(Schema.Type.FLOAT), f); case DOUBLE: - return Schema.create(Schema.Type.DOUBLE); + return getSchema(Schema.create(Schema.Type.DOUBLE), f); case STRING: Schema s = Schema.create(Schema.Type.STRING); GenericData.setStringType(s, GenericData.StringType.String); - return s; + return getSchema(s, f); case BYTES: - return Schema.create(Schema.Type.BYTES); + return getSchema(Schema.create(Schema.Type.BYTES), f); case INT32: case UINT32: case SINT32: case FIXED32: case SFIXED32: - return Schema.create(Schema.Type.INT); + return getSchema(Schema.create(Schema.Type.INT), f); case INT64: case UINT64: case SINT64: case FIXED64: case SFIXED64: - return Schema.create(Schema.Type.LONG); + return getSchema(Schema.create(Schema.Type.LONG), f); case ENUM: - return getSchema(f.getEnumType()); + return getSchema(getSchema(f.getEnumType()), f); case MESSAGE: - result = getSchema(f.getMessageType()); - if (f.isOptional()) - // wrap optional record fields in a union with null - result = Schema.createUnion(Arrays.asList(NULL, result)); - return result; + return getSchema(getSchema(f.getMessageType()), f); case GROUP: // groups are deprecated default: throw new RuntimeException("Unexpected type: " + f.getType()); } } + private Schema getSchema(Schema schema, FieldDescriptor f) { + if (f.isOptional() && !f.hasDefaultValue()) { + // wrap optional record fields in a union with null + JsonNode defaultValue = this.getDefault(f); + final List subSchemas; + if (defaultValue == NullNode.getInstance()) { + subSchemas = Arrays.asList(NULL, schema); + } else { + subSchemas = Arrays.asList(schema, NULL); + } + return Schema.createUnion(subSchemas); + } else { + return schema; + } + } + public Schema getSchema(EnumDescriptor d) { List symbols = new ArrayList<>(d.getValues().size()); for (EnumValueDescriptor e : d.getValues()) { diff --git a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java index 5ac34fdae65..1255b773177 100644 --- a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java +++ b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java @@ -19,8 +19,14 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.util.Arrays; import org.apache.avro.Schema; +import org.apache.avro.generic.GenericData; +import org.apache.avro.generic.GenericDatumReader; +import org.apache.avro.generic.GenericEnumSymbol; +import org.apache.avro.generic.GenericRecord; +import org.apache.avro.io.Decoder; import org.apache.avro.io.DecoderFactory; import org.apache.avro.io.Encoder; import org.apache.avro.io.EncoderFactory; @@ -30,14 +36,30 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import com.google.protobuf.ByteString; import org.apache.avro.protobuf.noopt.Test.Foo; import org.apache.avro.protobuf.noopt.Test.A; +import org.apache.avro.protobuf.noopt.Test.M; import org.apache.avro.protobuf.noopt.Test.M.N; public class TestProtobuf { + + protected GenericRecord convertProtoToAvro(T objToConvert, Class clazz) throws Exception { + ByteArrayOutputStream bao = new ByteArrayOutputStream(); + ProtobufDatumWriter w = new ProtobufDatumWriter(clazz); + Schema schema = ProtobufData.get().getSchema(clazz); + Encoder e = EncoderFactory.get().jsonEncoder(schema, bao); + w.write(objToConvert, e); + e.flush(); + GenericDatumReader gdr = new GenericDatumReader(schema, schema); + Decoder d = DecoderFactory.get().jsonDecoder(schema, new ByteArrayInputStream(bao.toByteArray())); + + return (GenericRecord) gdr.read(null, d); + } + @Test void message() throws Exception { @@ -146,4 +168,59 @@ void getNonRepeatedSchemaWithLogicalType() throws Exception { Schema s2 = instance2.getSchema(com.google.protobuf.Timestamp.class); assertEquals(conversion.getRecommendedSchema(), s2); } + + @Test + void nestedEnumWithValue() throws Exception { + Schema enumSchema = Schema.createEnum("N", null, null, Arrays.asList("A")); + GenericEnumSymbol enumA = new GenericData.EnumSymbol(enumSchema, "A"); + + M.Builder builder = M.newBuilder(); + builder.setEnumN(M.N.A); + + GenericRecord converted = convertProtoToAvro(builder.build(), M.class); + + assertEquals(0, ((GenericEnumSymbol) converted.get("enumN")).compareTo(enumA)); + } + + @Test + void nestedEnumWithNull() throws Exception { + M.Builder builder = M.newBuilder(); + + GenericRecord converted = convertProtoToAvro(builder.build(), M.class); + + assertNull(converted.get("enumN")); + } + + @Test + void handlingOptionalValuesCorrectly() throws Exception { + Schema enumSchema = Schema.createEnum("A", null, null, Arrays.asList("X", "Y", "Z")); + GenericEnumSymbol enumZ = new GenericData.EnumSymbol(enumSchema, "Z"); + + Foo.Builder builder = Foo.newBuilder(); + builder.setInt32(10); + builder.setInt64(2); + Foo foo = builder.build(); + + GenericRecord converted = convertProtoToAvro(foo, Foo.class); + + assertEquals(10, converted.get("int32")); + assertEquals(2L, converted.get("int64")); + assertNull(converted.get("uint32")); + assertNull(converted.get("uint64")); + assertNull(converted.get("sint32")); + assertNull(converted.get("sint64")); + assertNull(converted.get("fixed32")); + assertNull(converted.get("fixed64")); + assertNull(converted.get("sfixed32")); + assertNull(converted.get("sfixed64")); + assertNull(converted.get("float")); + assertNull(converted.get("double")); + assertNull(converted.get("bool")); + assertNull(converted.get("string")); + assertNull(converted.get("bytes")); + assertEquals(0, ((GenericEnumSymbol) converted.get("enum")).compareTo(enumZ)); + assertEquals(0, ((GenericData.Array) converted.get("intArray")).size()); + assertEquals(0, ((GenericData.Array) converted.get("fooArray")).size()); + assertEquals(0, ((GenericData.Array) converted.get("syms")).size()); + } } diff --git a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/A.java b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/A.java index 20633d5b7df..ccf58f88bec 100644 --- a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/A.java +++ b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/A.java @@ -42,6 +42,8 @@ public final int getNumber() { } /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -49,6 +51,10 @@ public static A valueOf(int value) { return forNumber(value); } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ public static A forNumber(int value) { switch (value) { case 1: diff --git a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/Foo.java b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/Foo.java index 58401507178..01aec60fe8d 100644 --- a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/Foo.java +++ b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/Foo.java @@ -17,27 +17,20 @@ private Foo(com.google.protobuf.GeneratedMessageV3.Builder builder) { } private Foo() { - int32_ = 0; - int64_ = 0L; - uint32_ = 0; - uint64_ = 0L; - sint32_ = 0; - sint64_ = 0L; - fixed32_ = 0; - fixed64_ = 0L; - sfixed32_ = 0; - sfixed64_ = 0L; - float_ = 0F; - double_ = 0D; - bool_ = false; string_ = ""; bytes_ = com.google.protobuf.ByteString.EMPTY; enum_ = 3; - intArray_ = java.util.Collections.emptyList(); + intArray_ = emptyIntList(); fooArray_ = java.util.Collections.emptyList(); syms_ = java.util.Collections.emptyList(); } + @java.lang.Override + @SuppressWarnings({ "unused" }) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Foo(); + } + @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; @@ -59,12 +52,6 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } case 8: { bitField0_ |= 0x00000001; int32_ = input.readInt32(); @@ -143,6 +130,7 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } case 128: { int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") org.apache.avro.protobuf.multiplefiles.A value = org.apache.avro.protobuf.multiplefiles.A.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(16, rawValue); @@ -153,29 +141,29 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte break; } case 136: { - if (!((mutable_bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = new java.util.ArrayList(); + if (!((mutable_bitField0_ & 0x00010000) != 0)) { + intArray_ = newIntList(); mutable_bitField0_ |= 0x00010000; } - intArray_.add(input.readInt32()); + intArray_.addInt(input.readInt32()); break; } case 138: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00010000) == 0x00010000) && input.getBytesUntilLimit() > 0) { - intArray_ = new java.util.ArrayList(); + if (!((mutable_bitField0_ & 0x00010000) != 0) && input.getBytesUntilLimit() > 0) { + intArray_ = newIntList(); mutable_bitField0_ |= 0x00010000; } while (input.getBytesUntilLimit() > 0) { - intArray_.add(input.readInt32()); + intArray_.addInt(input.readInt32()); } input.popLimit(limit); break; } case 146: { org.apache.avro.protobuf.multiplefiles.Foo.Builder subBuilder = null; - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00010000) != 0)) { subBuilder = foo_.toBuilder(); } foo_ = input.readMessage(org.apache.avro.protobuf.multiplefiles.Foo.PARSER, extensionRegistry); @@ -188,11 +176,12 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } case 152: { int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") org.apache.avro.protobuf.multiplefiles.A value = org.apache.avro.protobuf.multiplefiles.A.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(19, rawValue); } else { - if (!((mutable_bitField0_ & 0x00040000) == 0x00040000)) { + if (!((mutable_bitField0_ & 0x00040000) != 0)) { syms_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00040000; } @@ -205,11 +194,12 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte int oldLimit = input.pushLimit(length); while (input.getBytesUntilLimit() > 0) { int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") org.apache.avro.protobuf.multiplefiles.A value = org.apache.avro.protobuf.multiplefiles.A.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(19, rawValue); } else { - if (!((mutable_bitField0_ & 0x00040000) == 0x00040000)) { + if (!((mutable_bitField0_ & 0x00040000) != 0)) { syms_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00040000; } @@ -220,7 +210,7 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte break; } case 162: { - if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) { + if (!((mutable_bitField0_ & 0x00020000) != 0)) { fooArray_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00020000; } @@ -229,7 +219,7 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } case 170: { com.google.protobuf.Timestamp.Builder subBuilder = null; - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { subBuilder = timestamp_.toBuilder(); } timestamp_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); @@ -240,6 +230,12 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte bitField0_ |= 0x00020000; break; } + default: { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -247,13 +243,13 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { - if (((mutable_bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = java.util.Collections.unmodifiableList(intArray_); + if (((mutable_bitField0_ & 0x00010000) != 0)) { + intArray_.makeImmutable(); // C } - if (((mutable_bitField0_ & 0x00040000) == 0x00040000)) { + if (((mutable_bitField0_ & 0x00040000) != 0)) { syms_ = java.util.Collections.unmodifiableList(syms_); } - if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) { + if (((mutable_bitField0_ & 0x00020000) != 0)) { fooArray_ = java.util.Collections.unmodifiableList(fooArray_); } this.unknownFields = unknownFields.build(); @@ -265,6 +261,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_Foo_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_Foo_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.multiplefiles.Foo.class, @@ -281,9 +278,12 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF * * * required int32 int32 = 1; + * + * @return Whether the int32 field is set. */ + @java.lang.Override public boolean hasInt32() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** @@ -292,7 +292,10 @@ public boolean hasInt32() { * * * required int32 int32 = 1; + * + * @return The int32. */ + @java.lang.Override public int getInt32() { return int32_; } @@ -302,14 +305,20 @@ public int getInt32() { /** * optional int64 int64 = 2; + * + * @return Whether the int64 field is set. */ + @java.lang.Override public boolean hasInt64() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional int64 int64 = 2; + * + * @return The int64. */ + @java.lang.Override public long getInt64() { return int64_; } @@ -319,14 +328,20 @@ public long getInt64() { /** * optional uint32 uint32 = 3; + * + * @return Whether the uint32 field is set. */ + @java.lang.Override public boolean hasUint32() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000004) != 0); } /** * optional uint32 uint32 = 3; + * + * @return The uint32. */ + @java.lang.Override public int getUint32() { return uint32_; } @@ -336,14 +351,20 @@ public int getUint32() { /** * optional uint64 uint64 = 4; + * + * @return Whether the uint64 field is set. */ + @java.lang.Override public boolean hasUint64() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000008) != 0); } /** * optional uint64 uint64 = 4; + * + * @return The uint64. */ + @java.lang.Override public long getUint64() { return uint64_; } @@ -353,14 +374,20 @@ public long getUint64() { /** * optional sint32 sint32 = 5; + * + * @return Whether the sint32 field is set. */ + @java.lang.Override public boolean hasSint32() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000010) != 0); } /** * optional sint32 sint32 = 5; + * + * @return The sint32. */ + @java.lang.Override public int getSint32() { return sint32_; } @@ -370,14 +397,20 @@ public int getSint32() { /** * optional sint64 sint64 = 6; + * + * @return Whether the sint64 field is set. */ + @java.lang.Override public boolean hasSint64() { - return ((bitField0_ & 0x00000020) == 0x00000020); + return ((bitField0_ & 0x00000020) != 0); } /** * optional sint64 sint64 = 6; + * + * @return The sint64. */ + @java.lang.Override public long getSint64() { return sint64_; } @@ -387,14 +420,20 @@ public long getSint64() { /** * optional fixed32 fixed32 = 7; + * + * @return Whether the fixed32 field is set. */ + @java.lang.Override public boolean hasFixed32() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000040) != 0); } /** * optional fixed32 fixed32 = 7; + * + * @return The fixed32. */ + @java.lang.Override public int getFixed32() { return fixed32_; } @@ -404,14 +443,20 @@ public int getFixed32() { /** * optional fixed64 fixed64 = 8; + * + * @return Whether the fixed64 field is set. */ + @java.lang.Override public boolean hasFixed64() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000080) != 0); } /** * optional fixed64 fixed64 = 8; + * + * @return The fixed64. */ + @java.lang.Override public long getFixed64() { return fixed64_; } @@ -421,14 +466,20 @@ public long getFixed64() { /** * optional sfixed32 sfixed32 = 9; + * + * @return Whether the sfixed32 field is set. */ + @java.lang.Override public boolean hasSfixed32() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000100) != 0); } /** * optional sfixed32 sfixed32 = 9; + * + * @return The sfixed32. */ + @java.lang.Override public int getSfixed32() { return sfixed32_; } @@ -438,14 +489,20 @@ public int getSfixed32() { /** * optional sfixed64 sfixed64 = 10; + * + * @return Whether the sfixed64 field is set. */ + @java.lang.Override public boolean hasSfixed64() { - return ((bitField0_ & 0x00000200) == 0x00000200); + return ((bitField0_ & 0x00000200) != 0); } /** * optional sfixed64 sfixed64 = 10; + * + * @return The sfixed64. */ + @java.lang.Override public long getSfixed64() { return sfixed64_; } @@ -455,14 +512,20 @@ public long getSfixed64() { /** * optional float float = 11; + * + * @return Whether the float field is set. */ + @java.lang.Override public boolean hasFloat() { - return ((bitField0_ & 0x00000400) == 0x00000400); + return ((bitField0_ & 0x00000400) != 0); } /** * optional float float = 11; + * + * @return The float. */ + @java.lang.Override public float getFloat() { return float_; } @@ -472,14 +535,20 @@ public float getFloat() { /** * optional double double = 12; + * + * @return Whether the double field is set. */ + @java.lang.Override public boolean hasDouble() { - return ((bitField0_ & 0x00000800) == 0x00000800); + return ((bitField0_ & 0x00000800) != 0); } /** * optional double double = 12; + * + * @return The double. */ + @java.lang.Override public double getDouble() { return double_; } @@ -489,14 +558,20 @@ public double getDouble() { /** * optional bool bool = 13; + * + * @return Whether the bool field is set. */ + @java.lang.Override public boolean hasBool() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00001000) != 0); } /** * optional bool bool = 13; + * + * @return The bool. */ + @java.lang.Override public boolean getBool() { return bool_; } @@ -506,14 +581,20 @@ public boolean getBool() { /** * optional string string = 14; + * + * @return Whether the string field is set. */ + @java.lang.Override public boolean hasString() { - return ((bitField0_ & 0x00002000) == 0x00002000); + return ((bitField0_ & 0x00002000) != 0); } /** * optional string string = 14; + * + * @return The string. */ + @java.lang.Override public java.lang.String getString() { java.lang.Object ref = string_; if (ref instanceof java.lang.String) { @@ -530,7 +611,10 @@ public java.lang.String getString() { /** * optional string string = 14; + * + * @return The bytes for string. */ + @java.lang.Override public com.google.protobuf.ByteString getStringBytes() { java.lang.Object ref = string_; if (ref instanceof java.lang.String) { @@ -547,14 +631,20 @@ public com.google.protobuf.ByteString getStringBytes() { /** * optional bytes bytes = 15; + * + * @return Whether the bytes field is set. */ + @java.lang.Override public boolean hasBytes() { - return ((bitField0_ & 0x00004000) == 0x00004000); + return ((bitField0_ & 0x00004000) != 0); } /** * optional bytes bytes = 15; + * + * @return The bytes. */ + @java.lang.Override public com.google.protobuf.ByteString getBytes() { return bytes_; } @@ -564,21 +654,28 @@ public com.google.protobuf.ByteString getBytes() { /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @return Whether the enum field is set. */ + @java.lang.Override public boolean hasEnum() { - return ((bitField0_ & 0x00008000) == 0x00008000); + return ((bitField0_ & 0x00008000) != 0); } /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @return The enum. */ + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.A getEnum() { + @SuppressWarnings("deprecation") org.apache.avro.protobuf.multiplefiles.A result = org.apache.avro.protobuf.multiplefiles.A.valueOf(enum_); return result == null ? org.apache.avro.protobuf.multiplefiles.A.Z : result; } public static final int INTARRAY_FIELD_NUMBER = 17; - private java.util.List intArray_; + private com.google.protobuf.Internal.IntList intArray_; /** *
@@ -586,7 +683,10 @@ public org.apache.avro.protobuf.multiplefiles.A getEnum() {
    * 
* * repeated int32 intArray = 17; + * + * @return A list containing the intArray. */ + @java.lang.Override public java.util.List getIntArrayList() { return intArray_; } @@ -597,6 +697,8 @@ public java.util.List getIntArrayList() { * * * repeated int32 intArray = 17; + * + * @return The count of intArray. */ public int getIntArrayCount() { return intArray_.size(); @@ -608,9 +710,12 @@ public int getIntArrayCount() { * * * repeated int32 intArray = 17; + * + * @param index The index of the element to return. + * @return The intArray at the given index. */ public int getIntArray(int index) { - return intArray_.get(index); + return intArray_.getInt(index); } public static final int FOOARRAY_FIELD_NUMBER = 20; @@ -619,6 +724,7 @@ public int getIntArray(int index) { /** * repeated .org.apache.avro.protobuf.multiplefiles.Foo fooArray = 20; */ + @java.lang.Override public java.util.List getFooArrayList() { return fooArray_; } @@ -626,6 +732,7 @@ public java.util.List getFooArrayLis /** * repeated .org.apache.avro.protobuf.multiplefiles.Foo fooArray = 20; */ + @java.lang.Override public java.util.List getFooArrayOrBuilderList() { return fooArray_; } @@ -633,6 +740,7 @@ public java.util.Listrepeated .org.apache.avro.protobuf.multiplefiles.Foo fooArray = 20; */ + @java.lang.Override public int getFooArrayCount() { return fooArray_.size(); } @@ -640,6 +748,7 @@ public int getFooArrayCount() { /** * repeated .org.apache.avro.protobuf.multiplefiles.Foo fooArray = 20; */ + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.Foo getFooArray(int index) { return fooArray_.get(index); } @@ -647,6 +756,7 @@ public org.apache.avro.protobuf.multiplefiles.Foo getFooArray(int index) { /** * repeated .org.apache.avro.protobuf.multiplefiles.Foo fooArray = 20; */ + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.FooOrBuilder getFooArrayOrBuilder(int index) { return fooArray_.get(index); } @@ -655,6 +765,7 @@ public org.apache.avro.protobuf.multiplefiles.FooOrBuilder getFooArrayOrBuilder( private java.util.List syms_; private static final com.google.protobuf.Internal.ListAdapter.Converter syms_converter_ = new com.google.protobuf.Internal.ListAdapter.Converter() { public org.apache.avro.protobuf.multiplefiles.A convert(java.lang.Integer from) { + @SuppressWarnings("deprecation") org.apache.avro.protobuf.multiplefiles.A result = org.apache.avro.protobuf.multiplefiles.A.valueOf(from); return result == null ? org.apache.avro.protobuf.multiplefiles.A.X : result; } @@ -662,7 +773,10 @@ public org.apache.avro.protobuf.multiplefiles.A convert(java.lang.Integer from) /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @return A list containing the syms. */ + @java.lang.Override public java.util.List getSymsList() { return new com.google.protobuf.Internal.ListAdapter( syms_, syms_converter_); @@ -670,14 +784,21 @@ public java.util.List getSymsList() { /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @return The count of syms. */ + @java.lang.Override public int getSymsCount() { return syms_.size(); } /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @param index The index of the element to return. + * @return The syms at the given index. */ + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.A getSyms(int index) { return syms_converter_.convert(syms_.get(index)); } @@ -691,9 +812,12 @@ public org.apache.avro.protobuf.multiplefiles.A getSyms(int index) { * * * optional .org.apache.avro.protobuf.multiplefiles.Foo foo = 18; + * + * @return Whether the foo field is set. */ + @java.lang.Override public boolean hasFoo() { - return ((bitField0_ & 0x00010000) == 0x00010000); + return ((bitField0_ & 0x00010000) != 0); } /** @@ -702,7 +826,10 @@ public boolean hasFoo() { * * * optional .org.apache.avro.protobuf.multiplefiles.Foo foo = 18; + * + * @return The foo. */ + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.Foo getFoo() { return foo_ == null ? org.apache.avro.protobuf.multiplefiles.Foo.getDefaultInstance() : foo_; } @@ -714,6 +841,7 @@ public org.apache.avro.protobuf.multiplefiles.Foo getFoo() { * * optional .org.apache.avro.protobuf.multiplefiles.Foo foo = 18; */ + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.FooOrBuilder getFooOrBuilder() { return foo_ == null ? org.apache.avro.protobuf.multiplefiles.Foo.getDefaultInstance() : foo_; } @@ -727,9 +855,12 @@ public org.apache.avro.protobuf.multiplefiles.FooOrBuilder getFooOrBuilder() { * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return Whether the timestamp field is set. */ + @java.lang.Override public boolean hasTimestamp() { - return ((bitField0_ & 0x00020000) == 0x00020000); + return ((bitField0_ & 0x00020000) != 0); } /** @@ -738,7 +869,10 @@ public boolean hasTimestamp() { * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return The timestamp. */ + @java.lang.Override public com.google.protobuf.Timestamp getTimestamp() { return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; } @@ -750,12 +884,14 @@ public com.google.protobuf.Timestamp getTimestamp() { * * optional .google.protobuf.Timestamp timestamp = 21; */ + @java.lang.Override public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) @@ -783,59 +919,60 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeInt32(1, int32_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { output.writeInt64(2, int64_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { output.writeUInt32(3, uint32_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000008) != 0)) { output.writeUInt64(4, uint64_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000010) != 0)) { output.writeSInt32(5, sint32_); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000020) != 0)) { output.writeSInt64(6, sint64_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000040) != 0)) { output.writeFixed32(7, fixed32_); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000080) != 0)) { output.writeFixed64(8, fixed64_); } - if (((bitField0_ & 0x00000100) == 0x00000100)) { + if (((bitField0_ & 0x00000100) != 0)) { output.writeSFixed32(9, sfixed32_); } - if (((bitField0_ & 0x00000200) == 0x00000200)) { + if (((bitField0_ & 0x00000200) != 0)) { output.writeSFixed64(10, sfixed64_); } - if (((bitField0_ & 0x00000400) == 0x00000400)) { + if (((bitField0_ & 0x00000400) != 0)) { output.writeFloat(11, float_); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000800) != 0)) { output.writeDouble(12, double_); } - if (((bitField0_ & 0x00001000) == 0x00001000)) { + if (((bitField0_ & 0x00001000) != 0)) { output.writeBool(13, bool_); } - if (((bitField0_ & 0x00002000) == 0x00002000)) { + if (((bitField0_ & 0x00002000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 14, string_); } - if (((bitField0_ & 0x00004000) == 0x00004000)) { + if (((bitField0_ & 0x00004000) != 0)) { output.writeBytes(15, bytes_); } - if (((bitField0_ & 0x00008000) == 0x00008000)) { + if (((bitField0_ & 0x00008000) != 0)) { output.writeEnum(16, enum_); } for (int i = 0; i < intArray_.size(); i++) { - output.writeInt32(17, intArray_.get(i)); + output.writeInt32(17, intArray_.getInt(i)); } - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00010000) != 0)) { output.writeMessage(18, getFoo()); } for (int i = 0; i < syms_.size(); i++) { @@ -844,75 +981,76 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < fooArray_.size(); i++) { output.writeMessage(20, fooArray_.get(i)); } - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { output.writeMessage(21, getTimestamp()); } unknownFields.writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, int32_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, int64_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.CodedOutputStream.computeUInt32Size(3, uint32_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000008) != 0)) { size += com.google.protobuf.CodedOutputStream.computeUInt64Size(4, uint64_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000010) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSInt32Size(5, sint32_); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000020) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSInt64Size(6, sint64_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000040) != 0)) { size += com.google.protobuf.CodedOutputStream.computeFixed32Size(7, fixed32_); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000080) != 0)) { size += com.google.protobuf.CodedOutputStream.computeFixed64Size(8, fixed64_); } - if (((bitField0_ & 0x00000100) == 0x00000100)) { + if (((bitField0_ & 0x00000100) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSFixed32Size(9, sfixed32_); } - if (((bitField0_ & 0x00000200) == 0x00000200)) { + if (((bitField0_ & 0x00000200) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSFixed64Size(10, sfixed64_); } - if (((bitField0_ & 0x00000400) == 0x00000400)) { + if (((bitField0_ & 0x00000400) != 0)) { size += com.google.protobuf.CodedOutputStream.computeFloatSize(11, float_); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000800) != 0)) { size += com.google.protobuf.CodedOutputStream.computeDoubleSize(12, double_); } - if (((bitField0_ & 0x00001000) == 0x00001000)) { + if (((bitField0_ & 0x00001000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(13, bool_); } - if (((bitField0_ & 0x00002000) == 0x00002000)) { + if (((bitField0_ & 0x00002000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, string_); } - if (((bitField0_ & 0x00004000) == 0x00004000)) { + if (((bitField0_ & 0x00004000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(15, bytes_); } - if (((bitField0_ & 0x00008000) == 0x00008000)) { + if (((bitField0_ & 0x00008000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(16, enum_); } { int dataSize = 0; for (int i = 0; i < intArray_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(intArray_.get(i)); + dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(intArray_.getInt(i)); } size += dataSize; size += 2 * getIntArrayList().size(); } - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00010000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(18, getFoo()); } { @@ -926,7 +1064,7 @@ public int getSerializedSize() { for (int i = 0; i < fooArray_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(20, fooArray_.get(i)); } - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(21, getTimestamp()); } size += unknownFields.getSerializedSize(); @@ -944,86 +1082,123 @@ public boolean equals(final java.lang.Object obj) { } org.apache.avro.protobuf.multiplefiles.Foo other = (org.apache.avro.protobuf.multiplefiles.Foo) obj; - boolean result = true; - result = result && (hasInt32() == other.hasInt32()); + if (hasInt32() != other.hasInt32()) + return false; if (hasInt32()) { - result = result && (getInt32() == other.getInt32()); + if (getInt32() != other.getInt32()) + return false; } - result = result && (hasInt64() == other.hasInt64()); + if (hasInt64() != other.hasInt64()) + return false; if (hasInt64()) { - result = result && (getInt64() == other.getInt64()); + if (getInt64() != other.getInt64()) + return false; } - result = result && (hasUint32() == other.hasUint32()); + if (hasUint32() != other.hasUint32()) + return false; if (hasUint32()) { - result = result && (getUint32() == other.getUint32()); + if (getUint32() != other.getUint32()) + return false; } - result = result && (hasUint64() == other.hasUint64()); + if (hasUint64() != other.hasUint64()) + return false; if (hasUint64()) { - result = result && (getUint64() == other.getUint64()); + if (getUint64() != other.getUint64()) + return false; } - result = result && (hasSint32() == other.hasSint32()); + if (hasSint32() != other.hasSint32()) + return false; if (hasSint32()) { - result = result && (getSint32() == other.getSint32()); + if (getSint32() != other.getSint32()) + return false; } - result = result && (hasSint64() == other.hasSint64()); + if (hasSint64() != other.hasSint64()) + return false; if (hasSint64()) { - result = result && (getSint64() == other.getSint64()); + if (getSint64() != other.getSint64()) + return false; } - result = result && (hasFixed32() == other.hasFixed32()); + if (hasFixed32() != other.hasFixed32()) + return false; if (hasFixed32()) { - result = result && (getFixed32() == other.getFixed32()); + if (getFixed32() != other.getFixed32()) + return false; } - result = result && (hasFixed64() == other.hasFixed64()); + if (hasFixed64() != other.hasFixed64()) + return false; if (hasFixed64()) { - result = result && (getFixed64() == other.getFixed64()); + if (getFixed64() != other.getFixed64()) + return false; } - result = result && (hasSfixed32() == other.hasSfixed32()); + if (hasSfixed32() != other.hasSfixed32()) + return false; if (hasSfixed32()) { - result = result && (getSfixed32() == other.getSfixed32()); + if (getSfixed32() != other.getSfixed32()) + return false; } - result = result && (hasSfixed64() == other.hasSfixed64()); + if (hasSfixed64() != other.hasSfixed64()) + return false; if (hasSfixed64()) { - result = result && (getSfixed64() == other.getSfixed64()); + if (getSfixed64() != other.getSfixed64()) + return false; } - result = result && (hasFloat() == other.hasFloat()); + if (hasFloat() != other.hasFloat()) + return false; if (hasFloat()) { - result = result - && (java.lang.Float.floatToIntBits(getFloat()) == java.lang.Float.floatToIntBits(other.getFloat())); + if (java.lang.Float.floatToIntBits(getFloat()) != java.lang.Float.floatToIntBits(other.getFloat())) + return false; } - result = result && (hasDouble() == other.hasDouble()); + if (hasDouble() != other.hasDouble()) + return false; if (hasDouble()) { - result = result - && (java.lang.Double.doubleToLongBits(getDouble()) == java.lang.Double.doubleToLongBits(other.getDouble())); + if (java.lang.Double.doubleToLongBits(getDouble()) != java.lang.Double.doubleToLongBits(other.getDouble())) + return false; } - result = result && (hasBool() == other.hasBool()); + if (hasBool() != other.hasBool()) + return false; if (hasBool()) { - result = result && (getBool() == other.getBool()); + if (getBool() != other.getBool()) + return false; } - result = result && (hasString() == other.hasString()); + if (hasString() != other.hasString()) + return false; if (hasString()) { - result = result && getString().equals(other.getString()); + if (!getString().equals(other.getString())) + return false; } - result = result && (hasBytes() == other.hasBytes()); + if (hasBytes() != other.hasBytes()) + return false; if (hasBytes()) { - result = result && getBytes().equals(other.getBytes()); + if (!getBytes().equals(other.getBytes())) + return false; } - result = result && (hasEnum() == other.hasEnum()); + if (hasEnum() != other.hasEnum()) + return false; if (hasEnum()) { - result = result && enum_ == other.enum_; + if (enum_ != other.enum_) + return false; } - result = result && getIntArrayList().equals(other.getIntArrayList()); - result = result && getFooArrayList().equals(other.getFooArrayList()); - result = result && syms_.equals(other.syms_); - result = result && (hasFoo() == other.hasFoo()); + if (!getIntArrayList().equals(other.getIntArrayList())) + return false; + if (!getFooArrayList().equals(other.getFooArrayList())) + return false; + if (!syms_.equals(other.syms_)) + return false; + if (hasFoo() != other.hasFoo()) + return false; if (hasFoo()) { - result = result && getFoo().equals(other.getFoo()); + if (!getFoo().equals(other.getFoo())) + return false; } - result = result && (hasTimestamp() == other.hasTimestamp()); + if (hasTimestamp() != other.hasTimestamp()) + return false; if (hasTimestamp()) { - result = result && getTimestamp().equals(other.getTimestamp()); + if (!getTimestamp().equals(other.getTimestamp())) + return false; } - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!unknownFields.equals(other.unknownFields)) + return false; + return true; } @java.lang.Override @@ -1185,6 +1360,7 @@ public static org.apache.avro.protobuf.multiplefiles.Foo parseFrom(com.google.pr return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } @@ -1197,6 +1373,7 @@ public static Builder newBuilder(org.apache.avro.protobuf.multiplefiles.Foo prot return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @@ -1217,6 +1394,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_Foo_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_Foo_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.multiplefiles.Foo.class, @@ -1241,6 +1419,7 @@ private void maybeForceBuilderInitialization() { } } + @java.lang.Override public Builder clear() { super.clear(); int32_ = 0; @@ -1275,7 +1454,7 @@ public Builder clear() { bitField0_ = (bitField0_ & ~0x00004000); enum_ = 3; bitField0_ = (bitField0_ & ~0x00008000); - intArray_ = java.util.Collections.emptyList(); + intArray_ = emptyIntList(); bitField0_ = (bitField0_ & ~0x00010000); if (fooArrayBuilder_ == null) { fooArray_ = java.util.Collections.emptyList(); @@ -1300,14 +1479,17 @@ public Builder clear() { return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_Foo_descriptor; } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.Foo getDefaultInstanceForType() { return org.apache.avro.protobuf.multiplefiles.Foo.getDefaultInstance(); } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.Foo build() { org.apache.avro.protobuf.multiplefiles.Foo result = buildPartial(); if (!result.isInitialized()) { @@ -1316,81 +1498,82 @@ public org.apache.avro.protobuf.multiplefiles.Foo build() { return result; } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.Foo buildPartial() { org.apache.avro.protobuf.multiplefiles.Foo result = new org.apache.avro.protobuf.multiplefiles.Foo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + if (((from_bitField0_ & 0x00000001) != 0)) { + result.int32_ = int32_; to_bitField0_ |= 0x00000001; } - result.int32_ = int32_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + if (((from_bitField0_ & 0x00000002) != 0)) { + result.int64_ = int64_; to_bitField0_ |= 0x00000002; } - result.int64_ = int64_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + if (((from_bitField0_ & 0x00000004) != 0)) { + result.uint32_ = uint32_; to_bitField0_ |= 0x00000004; } - result.uint32_ = uint32_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + if (((from_bitField0_ & 0x00000008) != 0)) { + result.uint64_ = uint64_; to_bitField0_ |= 0x00000008; } - result.uint64_ = uint64_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + if (((from_bitField0_ & 0x00000010) != 0)) { + result.sint32_ = sint32_; to_bitField0_ |= 0x00000010; } - result.sint32_ = sint32_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + if (((from_bitField0_ & 0x00000020) != 0)) { + result.sint64_ = sint64_; to_bitField0_ |= 0x00000020; } - result.sint64_ = sint64_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + if (((from_bitField0_ & 0x00000040) != 0)) { + result.fixed32_ = fixed32_; to_bitField0_ |= 0x00000040; } - result.fixed32_ = fixed32_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + if (((from_bitField0_ & 0x00000080) != 0)) { + result.fixed64_ = fixed64_; to_bitField0_ |= 0x00000080; } - result.fixed64_ = fixed64_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + if (((from_bitField0_ & 0x00000100) != 0)) { + result.sfixed32_ = sfixed32_; to_bitField0_ |= 0x00000100; } - result.sfixed32_ = sfixed32_; - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + if (((from_bitField0_ & 0x00000200) != 0)) { + result.sfixed64_ = sfixed64_; to_bitField0_ |= 0x00000200; } - result.sfixed64_ = sfixed64_; - if (((from_bitField0_ & 0x00000400) == 0x00000400)) { + if (((from_bitField0_ & 0x00000400) != 0)) { + result.float_ = float_; to_bitField0_ |= 0x00000400; } - result.float_ = float_; - if (((from_bitField0_ & 0x00000800) == 0x00000800)) { + if (((from_bitField0_ & 0x00000800) != 0)) { + result.double_ = double_; to_bitField0_ |= 0x00000800; } - result.double_ = double_; - if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + if (((from_bitField0_ & 0x00001000) != 0)) { + result.bool_ = bool_; to_bitField0_ |= 0x00001000; } - result.bool_ = bool_; - if (((from_bitField0_ & 0x00002000) == 0x00002000)) { + if (((from_bitField0_ & 0x00002000) != 0)) { to_bitField0_ |= 0x00002000; } result.string_ = string_; - if (((from_bitField0_ & 0x00004000) == 0x00004000)) { + if (((from_bitField0_ & 0x00004000) != 0)) { to_bitField0_ |= 0x00004000; } result.bytes_ = bytes_; - if (((from_bitField0_ & 0x00008000) == 0x00008000)) { + if (((from_bitField0_ & 0x00008000) != 0)) { to_bitField0_ |= 0x00008000; } result.enum_ = enum_; - if (((bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = java.util.Collections.unmodifiableList(intArray_); + if (((bitField0_ & 0x00010000) != 0)) { + intArray_.makeImmutable(); bitField0_ = (bitField0_ & ~0x00010000); } result.intArray_ = intArray_; if (fooArrayBuilder_ == null) { - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { fooArray_ = java.util.Collections.unmodifiableList(fooArray_); bitField0_ = (bitField0_ & ~0x00020000); } @@ -1398,57 +1581,64 @@ public org.apache.avro.protobuf.multiplefiles.Foo buildPartial() { } else { result.fooArray_ = fooArrayBuilder_.build(); } - if (((bitField0_ & 0x00040000) == 0x00040000)) { + if (((bitField0_ & 0x00040000) != 0)) { syms_ = java.util.Collections.unmodifiableList(syms_); bitField0_ = (bitField0_ & ~0x00040000); } result.syms_ = syms_; - if (((from_bitField0_ & 0x00080000) == 0x00080000)) { + if (((from_bitField0_ & 0x00080000) != 0)) { + if (fooBuilder_ == null) { + result.foo_ = foo_; + } else { + result.foo_ = fooBuilder_.build(); + } to_bitField0_ |= 0x00010000; } - if (fooBuilder_ == null) { - result.foo_ = foo_; - } else { - result.foo_ = fooBuilder_.build(); - } - if (((from_bitField0_ & 0x00100000) == 0x00100000)) { + if (((from_bitField0_ & 0x00100000) != 0)) { + if (timestampBuilder_ == null) { + result.timestamp_ = timestamp_; + } else { + result.timestamp_ = timestampBuilder_.build(); + } to_bitField0_ |= 0x00020000; } - if (timestampBuilder_ == null) { - result.timestamp_ = timestamp_; - } else { - result.timestamp_ = timestampBuilder_.build(); - } result.bitField0_ = to_bitField0_; onBuilt(); return result; } + @java.lang.Override public Builder clone() { - return (Builder) super.clone(); + return super.clone(); } + @java.lang.Override public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.setField(field, value); + return super.setField(field, value); } + @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); + return super.clearField(field); } + @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); + return super.clearOneof(oneof); } + @java.lang.Override public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); + return super.setRepeatedField(field, index, value); } + @java.lang.Override public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); + return super.addRepeatedField(field, value); } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.apache.avro.protobuf.multiplefiles.Foo) { return mergeFrom((org.apache.avro.protobuf.multiplefiles.Foo) other); @@ -1567,6 +1757,7 @@ public Builder mergeFrom(org.apache.avro.protobuf.multiplefiles.Foo other) { return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasInt32()) { return false; @@ -1584,6 +1775,7 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.apache.avro.protobuf.multiplefiles.Foo parsedMessage = null; @@ -1610,9 +1802,12 @@ public Builder mergeFrom(com.google.protobuf.CodedInputStream input, * * * required int32 int32 = 1; + * + * @return Whether the int32 field is set. */ + @java.lang.Override public boolean hasInt32() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** @@ -1621,7 +1816,10 @@ public boolean hasInt32() { * * * required int32 int32 = 1; + * + * @return The int32. */ + @java.lang.Override public int getInt32() { return int32_; } @@ -1632,6 +1830,9 @@ public int getInt32() { * * * required int32 int32 = 1; + * + * @param value The int32 to set. + * @return This builder for chaining. */ public Builder setInt32(int value) { bitField0_ |= 0x00000001; @@ -1646,6 +1847,8 @@ public Builder setInt32(int value) { * * * required int32 int32 = 1; + * + * @return This builder for chaining. */ public Builder clearInt32() { bitField0_ = (bitField0_ & ~0x00000001); @@ -1658,20 +1861,29 @@ public Builder clearInt32() { /** * optional int64 int64 = 2; + * + * @return Whether the int64 field is set. */ + @java.lang.Override public boolean hasInt64() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional int64 int64 = 2; + * + * @return The int64. */ + @java.lang.Override public long getInt64() { return int64_; } /** * optional int64 int64 = 2; + * + * @param value The int64 to set. + * @return This builder for chaining. */ public Builder setInt64(long value) { bitField0_ |= 0x00000002; @@ -1682,6 +1894,8 @@ public Builder setInt64(long value) { /** * optional int64 int64 = 2; + * + * @return This builder for chaining. */ public Builder clearInt64() { bitField0_ = (bitField0_ & ~0x00000002); @@ -1694,20 +1908,29 @@ public Builder clearInt64() { /** * optional uint32 uint32 = 3; + * + * @return Whether the uint32 field is set. */ + @java.lang.Override public boolean hasUint32() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000004) != 0); } /** * optional uint32 uint32 = 3; + * + * @return The uint32. */ + @java.lang.Override public int getUint32() { return uint32_; } /** * optional uint32 uint32 = 3; + * + * @param value The uint32 to set. + * @return This builder for chaining. */ public Builder setUint32(int value) { bitField0_ |= 0x00000004; @@ -1718,6 +1941,8 @@ public Builder setUint32(int value) { /** * optional uint32 uint32 = 3; + * + * @return This builder for chaining. */ public Builder clearUint32() { bitField0_ = (bitField0_ & ~0x00000004); @@ -1730,20 +1955,29 @@ public Builder clearUint32() { /** * optional uint64 uint64 = 4; + * + * @return Whether the uint64 field is set. */ + @java.lang.Override public boolean hasUint64() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000008) != 0); } /** * optional uint64 uint64 = 4; + * + * @return The uint64. */ + @java.lang.Override public long getUint64() { return uint64_; } /** * optional uint64 uint64 = 4; + * + * @param value The uint64 to set. + * @return This builder for chaining. */ public Builder setUint64(long value) { bitField0_ |= 0x00000008; @@ -1754,6 +1988,8 @@ public Builder setUint64(long value) { /** * optional uint64 uint64 = 4; + * + * @return This builder for chaining. */ public Builder clearUint64() { bitField0_ = (bitField0_ & ~0x00000008); @@ -1766,20 +2002,29 @@ public Builder clearUint64() { /** * optional sint32 sint32 = 5; + * + * @return Whether the sint32 field is set. */ + @java.lang.Override public boolean hasSint32() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000010) != 0); } /** * optional sint32 sint32 = 5; + * + * @return The sint32. */ + @java.lang.Override public int getSint32() { return sint32_; } /** * optional sint32 sint32 = 5; + * + * @param value The sint32 to set. + * @return This builder for chaining. */ public Builder setSint32(int value) { bitField0_ |= 0x00000010; @@ -1790,6 +2035,8 @@ public Builder setSint32(int value) { /** * optional sint32 sint32 = 5; + * + * @return This builder for chaining. */ public Builder clearSint32() { bitField0_ = (bitField0_ & ~0x00000010); @@ -1802,20 +2049,29 @@ public Builder clearSint32() { /** * optional sint64 sint64 = 6; + * + * @return Whether the sint64 field is set. */ + @java.lang.Override public boolean hasSint64() { - return ((bitField0_ & 0x00000020) == 0x00000020); + return ((bitField0_ & 0x00000020) != 0); } /** * optional sint64 sint64 = 6; + * + * @return The sint64. */ + @java.lang.Override public long getSint64() { return sint64_; } /** * optional sint64 sint64 = 6; + * + * @param value The sint64 to set. + * @return This builder for chaining. */ public Builder setSint64(long value) { bitField0_ |= 0x00000020; @@ -1826,6 +2082,8 @@ public Builder setSint64(long value) { /** * optional sint64 sint64 = 6; + * + * @return This builder for chaining. */ public Builder clearSint64() { bitField0_ = (bitField0_ & ~0x00000020); @@ -1838,20 +2096,29 @@ public Builder clearSint64() { /** * optional fixed32 fixed32 = 7; + * + * @return Whether the fixed32 field is set. */ + @java.lang.Override public boolean hasFixed32() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000040) != 0); } /** * optional fixed32 fixed32 = 7; + * + * @return The fixed32. */ + @java.lang.Override public int getFixed32() { return fixed32_; } /** * optional fixed32 fixed32 = 7; + * + * @param value The fixed32 to set. + * @return This builder for chaining. */ public Builder setFixed32(int value) { bitField0_ |= 0x00000040; @@ -1862,6 +2129,8 @@ public Builder setFixed32(int value) { /** * optional fixed32 fixed32 = 7; + * + * @return This builder for chaining. */ public Builder clearFixed32() { bitField0_ = (bitField0_ & ~0x00000040); @@ -1874,20 +2143,29 @@ public Builder clearFixed32() { /** * optional fixed64 fixed64 = 8; + * + * @return Whether the fixed64 field is set. */ + @java.lang.Override public boolean hasFixed64() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000080) != 0); } /** * optional fixed64 fixed64 = 8; + * + * @return The fixed64. */ + @java.lang.Override public long getFixed64() { return fixed64_; } /** * optional fixed64 fixed64 = 8; + * + * @param value The fixed64 to set. + * @return This builder for chaining. */ public Builder setFixed64(long value) { bitField0_ |= 0x00000080; @@ -1898,6 +2176,8 @@ public Builder setFixed64(long value) { /** * optional fixed64 fixed64 = 8; + * + * @return This builder for chaining. */ public Builder clearFixed64() { bitField0_ = (bitField0_ & ~0x00000080); @@ -1910,20 +2190,29 @@ public Builder clearFixed64() { /** * optional sfixed32 sfixed32 = 9; + * + * @return Whether the sfixed32 field is set. */ + @java.lang.Override public boolean hasSfixed32() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000100) != 0); } /** * optional sfixed32 sfixed32 = 9; + * + * @return The sfixed32. */ + @java.lang.Override public int getSfixed32() { return sfixed32_; } /** * optional sfixed32 sfixed32 = 9; + * + * @param value The sfixed32 to set. + * @return This builder for chaining. */ public Builder setSfixed32(int value) { bitField0_ |= 0x00000100; @@ -1934,6 +2223,8 @@ public Builder setSfixed32(int value) { /** * optional sfixed32 sfixed32 = 9; + * + * @return This builder for chaining. */ public Builder clearSfixed32() { bitField0_ = (bitField0_ & ~0x00000100); @@ -1946,20 +2237,29 @@ public Builder clearSfixed32() { /** * optional sfixed64 sfixed64 = 10; + * + * @return Whether the sfixed64 field is set. */ + @java.lang.Override public boolean hasSfixed64() { - return ((bitField0_ & 0x00000200) == 0x00000200); + return ((bitField0_ & 0x00000200) != 0); } /** * optional sfixed64 sfixed64 = 10; + * + * @return The sfixed64. */ + @java.lang.Override public long getSfixed64() { return sfixed64_; } /** * optional sfixed64 sfixed64 = 10; + * + * @param value The sfixed64 to set. + * @return This builder for chaining. */ public Builder setSfixed64(long value) { bitField0_ |= 0x00000200; @@ -1970,6 +2270,8 @@ public Builder setSfixed64(long value) { /** * optional sfixed64 sfixed64 = 10; + * + * @return This builder for chaining. */ public Builder clearSfixed64() { bitField0_ = (bitField0_ & ~0x00000200); @@ -1982,20 +2284,29 @@ public Builder clearSfixed64() { /** * optional float float = 11; + * + * @return Whether the float field is set. */ + @java.lang.Override public boolean hasFloat() { - return ((bitField0_ & 0x00000400) == 0x00000400); + return ((bitField0_ & 0x00000400) != 0); } /** * optional float float = 11; + * + * @return The float. */ + @java.lang.Override public float getFloat() { return float_; } /** * optional float float = 11; + * + * @param value The float to set. + * @return This builder for chaining. */ public Builder setFloat(float value) { bitField0_ |= 0x00000400; @@ -2006,6 +2317,8 @@ public Builder setFloat(float value) { /** * optional float float = 11; + * + * @return This builder for chaining. */ public Builder clearFloat() { bitField0_ = (bitField0_ & ~0x00000400); @@ -2018,20 +2331,29 @@ public Builder clearFloat() { /** * optional double double = 12; + * + * @return Whether the double field is set. */ + @java.lang.Override public boolean hasDouble() { - return ((bitField0_ & 0x00000800) == 0x00000800); + return ((bitField0_ & 0x00000800) != 0); } /** * optional double double = 12; + * + * @return The double. */ + @java.lang.Override public double getDouble() { return double_; } /** * optional double double = 12; + * + * @param value The double to set. + * @return This builder for chaining. */ public Builder setDouble(double value) { bitField0_ |= 0x00000800; @@ -2042,6 +2364,8 @@ public Builder setDouble(double value) { /** * optional double double = 12; + * + * @return This builder for chaining. */ public Builder clearDouble() { bitField0_ = (bitField0_ & ~0x00000800); @@ -2054,20 +2378,29 @@ public Builder clearDouble() { /** * optional bool bool = 13; + * + * @return Whether the bool field is set. */ + @java.lang.Override public boolean hasBool() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00001000) != 0); } /** * optional bool bool = 13; + * + * @return The bool. */ + @java.lang.Override public boolean getBool() { return bool_; } /** * optional bool bool = 13; + * + * @param value The bool to set. + * @return This builder for chaining. */ public Builder setBool(boolean value) { bitField0_ |= 0x00001000; @@ -2078,6 +2411,8 @@ public Builder setBool(boolean value) { /** * optional bool bool = 13; + * + * @return This builder for chaining. */ public Builder clearBool() { bitField0_ = (bitField0_ & ~0x00001000); @@ -2090,13 +2425,17 @@ public Builder clearBool() { /** * optional string string = 14; + * + * @return Whether the string field is set. */ public boolean hasString() { - return ((bitField0_ & 0x00002000) == 0x00002000); + return ((bitField0_ & 0x00002000) != 0); } /** * optional string string = 14; + * + * @return The string. */ public java.lang.String getString() { java.lang.Object ref = string_; @@ -2114,6 +2453,8 @@ public java.lang.String getString() { /** * optional string string = 14; + * + * @return The bytes for string. */ public com.google.protobuf.ByteString getStringBytes() { java.lang.Object ref = string_; @@ -2128,6 +2469,9 @@ public com.google.protobuf.ByteString getStringBytes() { /** * optional string string = 14; + * + * @param value The string to set. + * @return This builder for chaining. */ public Builder setString(java.lang.String value) { if (value == null) { @@ -2141,6 +2485,8 @@ public Builder setString(java.lang.String value) { /** * optional string string = 14; + * + * @return This builder for chaining. */ public Builder clearString() { bitField0_ = (bitField0_ & ~0x00002000); @@ -2151,6 +2497,9 @@ public Builder clearString() { /** * optional string string = 14; + * + * @param value The bytes for string to set. + * @return This builder for chaining. */ public Builder setStringBytes(com.google.protobuf.ByteString value) { if (value == null) { @@ -2166,20 +2515,29 @@ public Builder setStringBytes(com.google.protobuf.ByteString value) { /** * optional bytes bytes = 15; + * + * @return Whether the bytes field is set. */ + @java.lang.Override public boolean hasBytes() { - return ((bitField0_ & 0x00004000) == 0x00004000); + return ((bitField0_ & 0x00004000) != 0); } /** * optional bytes bytes = 15; + * + * @return The bytes. */ + @java.lang.Override public com.google.protobuf.ByteString getBytes() { return bytes_; } /** * optional bytes bytes = 15; + * + * @param value The bytes to set. + * @return This builder for chaining. */ public Builder setBytes(com.google.protobuf.ByteString value) { if (value == null) { @@ -2193,6 +2551,8 @@ public Builder setBytes(com.google.protobuf.ByteString value) { /** * optional bytes bytes = 15; + * + * @return This builder for chaining. */ public Builder clearBytes() { bitField0_ = (bitField0_ & ~0x00004000); @@ -2205,21 +2565,31 @@ public Builder clearBytes() { /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @return Whether the enum field is set. */ + @java.lang.Override public boolean hasEnum() { - return ((bitField0_ & 0x00008000) == 0x00008000); + return ((bitField0_ & 0x00008000) != 0); } /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @return The enum. */ + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.A getEnum() { + @SuppressWarnings("deprecation") org.apache.avro.protobuf.multiplefiles.A result = org.apache.avro.protobuf.multiplefiles.A.valueOf(enum_); return result == null ? org.apache.avro.protobuf.multiplefiles.A.Z : result; } /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @param value The enum to set. + * @return This builder for chaining. */ public Builder setEnum(org.apache.avro.protobuf.multiplefiles.A value) { if (value == null) { @@ -2233,6 +2603,8 @@ public Builder setEnum(org.apache.avro.protobuf.multiplefiles.A value) { /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @return This builder for chaining. */ public Builder clearEnum() { bitField0_ = (bitField0_ & ~0x00008000); @@ -2241,11 +2613,11 @@ public Builder clearEnum() { return this; } - private java.util.List intArray_ = java.util.Collections.emptyList(); + private com.google.protobuf.Internal.IntList intArray_ = emptyIntList(); private void ensureIntArrayIsMutable() { - if (!((bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = new java.util.ArrayList(intArray_); + if (!((bitField0_ & 0x00010000) != 0)) { + intArray_ = mutableCopy(intArray_); bitField0_ |= 0x00010000; } } @@ -2256,9 +2628,11 @@ private void ensureIntArrayIsMutable() { * * * repeated int32 intArray = 17; + * + * @return A list containing the intArray. */ public java.util.List getIntArrayList() { - return java.util.Collections.unmodifiableList(intArray_); + return ((bitField0_ & 0x00010000) != 0) ? java.util.Collections.unmodifiableList(intArray_) : intArray_; } /** @@ -2267,6 +2641,8 @@ public java.util.List getIntArrayList() { * * * repeated int32 intArray = 17; + * + * @return The count of intArray. */ public int getIntArrayCount() { return intArray_.size(); @@ -2278,9 +2654,12 @@ public int getIntArrayCount() { * * * repeated int32 intArray = 17; + * + * @param index The index of the element to return. + * @return The intArray at the given index. */ public int getIntArray(int index) { - return intArray_.get(index); + return intArray_.getInt(index); } /** @@ -2289,10 +2668,14 @@ public int getIntArray(int index) { * * * repeated int32 intArray = 17; + * + * @param index The index to set the value at. + * @param value The intArray to set. + * @return This builder for chaining. */ public Builder setIntArray(int index, int value) { ensureIntArrayIsMutable(); - intArray_.set(index, value); + intArray_.setInt(index, value); onChanged(); return this; } @@ -2303,10 +2686,13 @@ public Builder setIntArray(int index, int value) { * * * repeated int32 intArray = 17; + * + * @param value The intArray to add. + * @return This builder for chaining. */ public Builder addIntArray(int value) { ensureIntArrayIsMutable(); - intArray_.add(value); + intArray_.addInt(value); onChanged(); return this; } @@ -2317,6 +2703,9 @@ public Builder addIntArray(int value) { * * * repeated int32 intArray = 17; + * + * @param values The intArray to add. + * @return This builder for chaining. */ public Builder addAllIntArray(java.lang.Iterable values) { ensureIntArrayIsMutable(); @@ -2331,9 +2720,11 @@ public Builder addAllIntArray(java.lang.Iterable va * * * repeated int32 intArray = 17; + * + * @return This builder for chaining. */ public Builder clearIntArray() { - intArray_ = java.util.Collections.emptyList(); + intArray_ = emptyIntList(); bitField0_ = (bitField0_ & ~0x00010000); onChanged(); return this; @@ -2342,7 +2733,7 @@ public Builder clearIntArray() { private java.util.List fooArray_ = java.util.Collections.emptyList(); private void ensureFooArrayIsMutable() { - if (!((bitField0_ & 0x00020000) == 0x00020000)) { + if (!((bitField0_ & 0x00020000) != 0)) { fooArray_ = new java.util.ArrayList(fooArray_); bitField0_ |= 0x00020000; } @@ -2572,7 +2963,7 @@ public java.util.List getFoo private com.google.protobuf.RepeatedFieldBuilderV3 getFooArrayFieldBuilder() { if (fooArrayBuilder_ == null) { fooArrayBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3( - fooArray_, ((bitField0_ & 0x00020000) == 0x00020000), getParentForChildren(), isClean()); + fooArray_, ((bitField0_ & 0x00020000) != 0), getParentForChildren(), isClean()); fooArray_ = null; } return fooArrayBuilder_; @@ -2581,7 +2972,7 @@ private com.google.protobuf.RepeatedFieldBuilderV3 syms_ = java.util.Collections.emptyList(); private void ensureSymsIsMutable() { - if (!((bitField0_ & 0x00040000) == 0x00040000)) { + if (!((bitField0_ & 0x00040000) != 0)) { syms_ = new java.util.ArrayList(syms_); bitField0_ |= 0x00040000; } @@ -2589,6 +2980,8 @@ private void ensureSymsIsMutable() { /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @return A list containing the syms. */ public java.util.List getSymsList() { return new com.google.protobuf.Internal.ListAdapter( @@ -2597,6 +2990,8 @@ public java.util.List getSymsList() { /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @return The count of syms. */ public int getSymsCount() { return syms_.size(); @@ -2604,6 +2999,9 @@ public int getSymsCount() { /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @param index The index of the element to return. + * @return The syms at the given index. */ public org.apache.avro.protobuf.multiplefiles.A getSyms(int index) { return syms_converter_.convert(syms_.get(index)); @@ -2611,6 +3009,10 @@ public org.apache.avro.protobuf.multiplefiles.A getSyms(int index) { /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @param index The index to set the value at. + * @param value The syms to set. + * @return This builder for chaining. */ public Builder setSyms(int index, org.apache.avro.protobuf.multiplefiles.A value) { if (value == null) { @@ -2624,6 +3026,9 @@ public Builder setSyms(int index, org.apache.avro.protobuf.multiplefiles.A value /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @param value The syms to add. + * @return This builder for chaining. */ public Builder addSyms(org.apache.avro.protobuf.multiplefiles.A value) { if (value == null) { @@ -2637,6 +3042,9 @@ public Builder addSyms(org.apache.avro.protobuf.multiplefiles.A value) { /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @param values The syms to add. + * @return This builder for chaining. */ public Builder addAllSyms(java.lang.Iterable values) { ensureSymsIsMutable(); @@ -2649,6 +3057,8 @@ public Builder addAllSyms(java.lang.Iterablerepeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @return This builder for chaining. */ public Builder clearSyms() { syms_ = java.util.Collections.emptyList(); @@ -2657,7 +3067,7 @@ public Builder clearSyms() { return this; } - private org.apache.avro.protobuf.multiplefiles.Foo foo_ = null; + private org.apache.avro.protobuf.multiplefiles.Foo foo_; private com.google.protobuf.SingleFieldBuilderV3 fooBuilder_; /** @@ -2666,9 +3076,11 @@ public Builder clearSyms() { * * * optional .org.apache.avro.protobuf.multiplefiles.Foo foo = 18; + * + * @return Whether the foo field is set. */ public boolean hasFoo() { - return ((bitField0_ & 0x00080000) == 0x00080000); + return ((bitField0_ & 0x00080000) != 0); } /** @@ -2677,6 +3089,8 @@ public boolean hasFoo() { * * * optional .org.apache.avro.protobuf.multiplefiles.Foo foo = 18; + * + * @return The foo. */ public org.apache.avro.protobuf.multiplefiles.Foo getFoo() { if (fooBuilder_ == null) { @@ -2734,7 +3148,7 @@ public Builder setFoo(org.apache.avro.protobuf.multiplefiles.Foo.Builder builder */ public Builder mergeFoo(org.apache.avro.protobuf.multiplefiles.Foo value) { if (fooBuilder_ == null) { - if (((bitField0_ & 0x00080000) == 0x00080000) && foo_ != null + if (((bitField0_ & 0x00080000) != 0) && foo_ != null && foo_ != org.apache.avro.protobuf.multiplefiles.Foo.getDefaultInstance()) { foo_ = org.apache.avro.protobuf.multiplefiles.Foo.newBuilder(foo_).mergeFrom(value).buildPartial(); } else { @@ -2810,7 +3224,7 @@ private com.google.protobuf.SingleFieldBuilderV3 timestampBuilder_; /** @@ -2819,9 +3233,11 @@ private com.google.protobuf.SingleFieldBuilderV3 * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return Whether the timestamp field is set. */ public boolean hasTimestamp() { - return ((bitField0_ & 0x00100000) == 0x00100000); + return ((bitField0_ & 0x00100000) != 0); } /** @@ -2830,6 +3246,8 @@ public boolean hasTimestamp() { * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return The timestamp. */ public com.google.protobuf.Timestamp getTimestamp() { if (timestampBuilder_ == null) { @@ -2887,7 +3305,7 @@ public Builder setTimestamp(com.google.protobuf.Timestamp.Builder builderForValu */ public Builder mergeTimestamp(com.google.protobuf.Timestamp value) { if (timestampBuilder_ == null) { - if (((bitField0_ & 0x00100000) == 0x00100000) && timestamp_ != null + if (((bitField0_ & 0x00100000) != 0) && timestamp_ != null && timestamp_ != com.google.protobuf.Timestamp.getDefaultInstance()) { timestamp_ = com.google.protobuf.Timestamp.newBuilder(timestamp_).mergeFrom(value).buildPartial(); } else { @@ -2963,10 +3381,12 @@ private com.google.protobuf.SingleFieldBuilderV3 PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public Foo parsePartialFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -3002,6 +3423,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.Foo getDefaultInstanceForType() { return DEFAULT_INSTANCE; } diff --git a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/FooOrBuilder.java b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/FooOrBuilder.java index 66c86920371..80da78d3e2e 100644 --- a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/FooOrBuilder.java +++ b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/FooOrBuilder.java @@ -13,6 +13,8 @@ public interface FooOrBuilder extends * * * required int32 int32 = 1; + * + * @return Whether the int32 field is set. */ boolean hasInt32(); @@ -22,161 +24,225 @@ public interface FooOrBuilder extends * * * required int32 int32 = 1; + * + * @return The int32. */ int getInt32(); /** * optional int64 int64 = 2; + * + * @return Whether the int64 field is set. */ boolean hasInt64(); /** * optional int64 int64 = 2; + * + * @return The int64. */ long getInt64(); /** * optional uint32 uint32 = 3; + * + * @return Whether the uint32 field is set. */ boolean hasUint32(); /** * optional uint32 uint32 = 3; + * + * @return The uint32. */ int getUint32(); /** * optional uint64 uint64 = 4; + * + * @return Whether the uint64 field is set. */ boolean hasUint64(); /** * optional uint64 uint64 = 4; + * + * @return The uint64. */ long getUint64(); /** * optional sint32 sint32 = 5; + * + * @return Whether the sint32 field is set. */ boolean hasSint32(); /** * optional sint32 sint32 = 5; + * + * @return The sint32. */ int getSint32(); /** * optional sint64 sint64 = 6; + * + * @return Whether the sint64 field is set. */ boolean hasSint64(); /** * optional sint64 sint64 = 6; + * + * @return The sint64. */ long getSint64(); /** * optional fixed32 fixed32 = 7; + * + * @return Whether the fixed32 field is set. */ boolean hasFixed32(); /** * optional fixed32 fixed32 = 7; + * + * @return The fixed32. */ int getFixed32(); /** * optional fixed64 fixed64 = 8; + * + * @return Whether the fixed64 field is set. */ boolean hasFixed64(); /** * optional fixed64 fixed64 = 8; + * + * @return The fixed64. */ long getFixed64(); /** * optional sfixed32 sfixed32 = 9; + * + * @return Whether the sfixed32 field is set. */ boolean hasSfixed32(); /** * optional sfixed32 sfixed32 = 9; + * + * @return The sfixed32. */ int getSfixed32(); /** * optional sfixed64 sfixed64 = 10; + * + * @return Whether the sfixed64 field is set. */ boolean hasSfixed64(); /** * optional sfixed64 sfixed64 = 10; + * + * @return The sfixed64. */ long getSfixed64(); /** * optional float float = 11; + * + * @return Whether the float field is set. */ boolean hasFloat(); /** * optional float float = 11; + * + * @return The float. */ float getFloat(); /** * optional double double = 12; + * + * @return Whether the double field is set. */ boolean hasDouble(); /** * optional double double = 12; + * + * @return The double. */ double getDouble(); /** * optional bool bool = 13; + * + * @return Whether the bool field is set. */ boolean hasBool(); /** * optional bool bool = 13; + * + * @return The bool. */ boolean getBool(); /** * optional string string = 14; + * + * @return Whether the string field is set. */ boolean hasString(); /** * optional string string = 14; + * + * @return The string. */ java.lang.String getString(); /** * optional string string = 14; + * + * @return The bytes for string. */ com.google.protobuf.ByteString getStringBytes(); /** * optional bytes bytes = 15; + * + * @return Whether the bytes field is set. */ boolean hasBytes(); /** * optional bytes bytes = 15; + * + * @return The bytes. */ com.google.protobuf.ByteString getBytes(); /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @return Whether the enum field is set. */ boolean hasEnum(); /** * optional .org.apache.avro.protobuf.multiplefiles.A enum = 16 [default = Z]; + * + * @return The enum. */ org.apache.avro.protobuf.multiplefiles.A getEnum(); @@ -186,6 +252,8 @@ public interface FooOrBuilder extends * * * repeated int32 intArray = 17; + * + * @return A list containing the intArray. */ java.util.List getIntArrayList(); @@ -195,6 +263,8 @@ public interface FooOrBuilder extends * * * repeated int32 intArray = 17; + * + * @return The count of intArray. */ int getIntArrayCount(); @@ -204,6 +274,9 @@ public interface FooOrBuilder extends * * * repeated int32 intArray = 17; + * + * @param index The index of the element to return. + * @return The intArray at the given index. */ int getIntArray(int index); @@ -234,16 +307,23 @@ public interface FooOrBuilder extends /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @return A list containing the syms. */ java.util.List getSymsList(); /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @return The count of syms. */ int getSymsCount(); /** * repeated .org.apache.avro.protobuf.multiplefiles.A syms = 19; + * + * @param index The index of the element to return. + * @return The syms at the given index. */ org.apache.avro.protobuf.multiplefiles.A getSyms(int index); @@ -253,6 +333,8 @@ public interface FooOrBuilder extends * * * optional .org.apache.avro.protobuf.multiplefiles.Foo foo = 18; + * + * @return Whether the foo field is set. */ boolean hasFoo(); @@ -262,6 +344,8 @@ public interface FooOrBuilder extends * * * optional .org.apache.avro.protobuf.multiplefiles.Foo foo = 18; + * + * @return The foo. */ org.apache.avro.protobuf.multiplefiles.Foo getFoo(); @@ -280,6 +364,8 @@ public interface FooOrBuilder extends * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return Whether the timestamp field is set. */ boolean hasTimestamp(); @@ -289,6 +375,8 @@ public interface FooOrBuilder extends * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return The timestamp. */ com.google.protobuf.Timestamp getTimestamp(); diff --git a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/M.java b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/M.java index 4f2ae42f053..565f92d4b19 100644 --- a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/M.java +++ b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/M.java @@ -23,6 +23,12 @@ private M(com.google.protobuf.GeneratedMessageV3.Builder builder) { private M() { } + @java.lang.Override + @SuppressWarnings({ "unused" }) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new M(); + } + @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; @@ -65,6 +71,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_M_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_M_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.multiplefiles.M.class, @@ -90,6 +97,8 @@ public final int getNumber() { } /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -97,6 +106,10 @@ public static N valueOf(int value) { return forNumber(value); } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ public static N forNumber(int value) { switch (value) { case 1: @@ -148,6 +161,7 @@ private N(int value) { private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) @@ -159,10 +173,12 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { unknownFields.writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) @@ -184,9 +200,9 @@ public boolean equals(final java.lang.Object obj) { } org.apache.avro.protobuf.multiplefiles.M other = (org.apache.avro.protobuf.multiplefiles.M) obj; - boolean result = true; - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!unknownFields.equals(other.unknownFields)) + return false; + return true; } @java.lang.Override @@ -264,6 +280,7 @@ public static org.apache.avro.protobuf.multiplefiles.M parseFrom(com.google.prot return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } @@ -276,6 +293,7 @@ public static Builder newBuilder(org.apache.avro.protobuf.multiplefiles.M protot return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @@ -300,6 +318,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_M_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_M_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.multiplefiles.M.class, @@ -321,19 +340,23 @@ private void maybeForceBuilderInitialization() { } } + @java.lang.Override public Builder clear() { super.clear(); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.apache.avro.protobuf.multiplefiles.TestMultipleFiles.internal_static_org_apache_avro_protobuf_multiplefiles_M_descriptor; } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.M getDefaultInstanceForType() { return org.apache.avro.protobuf.multiplefiles.M.getDefaultInstance(); } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.M build() { org.apache.avro.protobuf.multiplefiles.M result = buildPartial(); if (!result.isInitialized()) { @@ -342,37 +365,45 @@ public org.apache.avro.protobuf.multiplefiles.M build() { return result; } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.M buildPartial() { org.apache.avro.protobuf.multiplefiles.M result = new org.apache.avro.protobuf.multiplefiles.M(this); onBuilt(); return result; } + @java.lang.Override public Builder clone() { - return (Builder) super.clone(); + return super.clone(); } + @java.lang.Override public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.setField(field, value); + return super.setField(field, value); } + @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); + return super.clearField(field); } + @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); + return super.clearOneof(oneof); } + @java.lang.Override public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); + return super.setRepeatedField(field, index, value); } + @java.lang.Override public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); + return super.addRepeatedField(field, value); } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.apache.avro.protobuf.multiplefiles.M) { return mergeFrom((org.apache.avro.protobuf.multiplefiles.M) other); @@ -390,10 +421,12 @@ public Builder mergeFrom(org.apache.avro.protobuf.multiplefiles.M other) { return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.apache.avro.protobuf.multiplefiles.M parsedMessage = null; @@ -410,10 +443,12 @@ public Builder mergeFrom(com.google.protobuf.CodedInputStream input, return this; } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } + @java.lang.Override public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } @@ -433,6 +468,7 @@ public static org.apache.avro.protobuf.multiplefiles.M getDefaultInstance() { @java.lang.Deprecated public static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public M parsePartialFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -449,6 +485,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.apache.avro.protobuf.multiplefiles.M getDefaultInstanceForType() { return DEFAULT_INSTANCE; } diff --git a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/TestMultipleFiles.java b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/TestMultipleFiles.java index 879d34f4f2a..1bd221f69b1 100644 --- a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/TestMultipleFiles.java +++ b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/multiplefiles/TestMultipleFiles.java @@ -41,16 +41,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "obuf.multiplefiles.Foo\022-\n\ttimestamp\030\025 \001(" + "\0132\032.google.protobuf.Timestamp\"\017\n\001M\"\n\n\001N\022" + "\005\n\001A\020\001*\030\n\001A\022\005\n\001X\020\001\022\005\n\001Y\020\002\022\005\n\001Z\020\003B\002P\001" }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.TimestampProto.getDescriptor(), }, - assigner); + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.TimestampProto.getDescriptor(), }); internal_static_org_apache_avro_protobuf_multiplefiles_Foo_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_org_apache_avro_protobuf_multiplefiles_Foo_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_org_apache_avro_protobuf_multiplefiles_Foo_descriptor, diff --git a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/noopt/Test.java b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/noopt/Test.java index 8255719d88e..334f39349f9 100644 --- a/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/noopt/Test.java +++ b/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/noopt/Test.java @@ -53,6 +53,8 @@ public final int getNumber() { } /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -60,6 +62,10 @@ public static A valueOf(int value) { return forNumber(value); } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ public static A forNumber(int value) { switch (value) { case 1: @@ -123,6 +129,8 @@ public interface FooOrBuilder extends * * * required int32 int32 = 1; + * + * @return Whether the int32 field is set. */ boolean hasInt32(); @@ -132,161 +140,225 @@ public interface FooOrBuilder extends * * * required int32 int32 = 1; + * + * @return The int32. */ int getInt32(); /** * optional int64 int64 = 2; + * + * @return Whether the int64 field is set. */ boolean hasInt64(); /** * optional int64 int64 = 2; + * + * @return The int64. */ long getInt64(); /** * optional uint32 uint32 = 3; + * + * @return Whether the uint32 field is set. */ boolean hasUint32(); /** * optional uint32 uint32 = 3; + * + * @return The uint32. */ int getUint32(); /** * optional uint64 uint64 = 4; + * + * @return Whether the uint64 field is set. */ boolean hasUint64(); /** * optional uint64 uint64 = 4; + * + * @return The uint64. */ long getUint64(); /** * optional sint32 sint32 = 5; + * + * @return Whether the sint32 field is set. */ boolean hasSint32(); /** * optional sint32 sint32 = 5; + * + * @return The sint32. */ int getSint32(); /** * optional sint64 sint64 = 6; + * + * @return Whether the sint64 field is set. */ boolean hasSint64(); /** * optional sint64 sint64 = 6; + * + * @return The sint64. */ long getSint64(); /** * optional fixed32 fixed32 = 7; + * + * @return Whether the fixed32 field is set. */ boolean hasFixed32(); /** * optional fixed32 fixed32 = 7; + * + * @return The fixed32. */ int getFixed32(); /** * optional fixed64 fixed64 = 8; + * + * @return Whether the fixed64 field is set. */ boolean hasFixed64(); /** * optional fixed64 fixed64 = 8; + * + * @return The fixed64. */ long getFixed64(); /** * optional sfixed32 sfixed32 = 9; + * + * @return Whether the sfixed32 field is set. */ boolean hasSfixed32(); /** * optional sfixed32 sfixed32 = 9; + * + * @return The sfixed32. */ int getSfixed32(); /** * optional sfixed64 sfixed64 = 10; + * + * @return Whether the sfixed64 field is set. */ boolean hasSfixed64(); /** * optional sfixed64 sfixed64 = 10; + * + * @return The sfixed64. */ long getSfixed64(); /** * optional float float = 11; + * + * @return Whether the float field is set. */ boolean hasFloat(); /** * optional float float = 11; + * + * @return The float. */ float getFloat(); /** * optional double double = 12; + * + * @return Whether the double field is set. */ boolean hasDouble(); /** * optional double double = 12; + * + * @return The double. */ double getDouble(); /** * optional bool bool = 13; + * + * @return Whether the bool field is set. */ boolean hasBool(); /** * optional bool bool = 13; + * + * @return The bool. */ boolean getBool(); /** * optional string string = 14; + * + * @return Whether the string field is set. */ boolean hasString(); /** * optional string string = 14; + * + * @return The string. */ java.lang.String getString(); /** * optional string string = 14; + * + * @return The bytes for string. */ com.google.protobuf.ByteString getStringBytes(); /** * optional bytes bytes = 15; + * + * @return Whether the bytes field is set. */ boolean hasBytes(); /** * optional bytes bytes = 15; + * + * @return The bytes. */ com.google.protobuf.ByteString getBytes(); /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @return Whether the enum field is set. */ boolean hasEnum(); /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @return The enum. */ org.apache.avro.protobuf.noopt.Test.A getEnum(); @@ -296,6 +368,8 @@ public interface FooOrBuilder extends * * * repeated int32 intArray = 17; + * + * @return A list containing the intArray. */ java.util.List getIntArrayList(); @@ -305,6 +379,8 @@ public interface FooOrBuilder extends * * * repeated int32 intArray = 17; + * + * @return The count of intArray. */ int getIntArrayCount(); @@ -314,6 +390,9 @@ public interface FooOrBuilder extends * * * repeated int32 intArray = 17; + * + * @param index The index of the element to return. + * @return The intArray at the given index. */ int getIntArray(int index); @@ -344,16 +423,23 @@ public interface FooOrBuilder extends /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @return A list containing the syms. */ java.util.List getSymsList(); /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @return The count of syms. */ int getSymsCount(); /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @param index The index of the element to return. + * @return The syms at the given index. */ org.apache.avro.protobuf.noopt.Test.A getSyms(int index); @@ -363,6 +449,8 @@ public interface FooOrBuilder extends * * * optional .org.apache.avro.protobuf.noopt.Foo foo = 18; + * + * @return Whether the foo field is set. */ boolean hasFoo(); @@ -372,6 +460,8 @@ public interface FooOrBuilder extends * * * optional .org.apache.avro.protobuf.noopt.Foo foo = 18; + * + * @return The foo. */ org.apache.avro.protobuf.noopt.Test.Foo getFoo(); @@ -390,6 +480,8 @@ public interface FooOrBuilder extends * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return Whether the timestamp field is set. */ boolean hasTimestamp(); @@ -399,6 +491,8 @@ public interface FooOrBuilder extends * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return The timestamp. */ com.google.protobuf.Timestamp getTimestamp(); @@ -426,27 +520,20 @@ private Foo(com.google.protobuf.GeneratedMessageV3.Builder builder) { } private Foo() { - int32_ = 0; - int64_ = 0L; - uint32_ = 0; - uint64_ = 0L; - sint32_ = 0; - sint64_ = 0L; - fixed32_ = 0; - fixed64_ = 0L; - sfixed32_ = 0; - sfixed64_ = 0L; - float_ = 0F; - double_ = 0D; - bool_ = false; string_ = ""; bytes_ = com.google.protobuf.ByteString.EMPTY; enum_ = 3; - intArray_ = java.util.Collections.emptyList(); + intArray_ = emptyIntList(); fooArray_ = java.util.Collections.emptyList(); syms_ = java.util.Collections.emptyList(); } + @java.lang.Override + @SuppressWarnings({ "unused" }) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Foo(); + } + @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; @@ -468,12 +555,6 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte case 0: done = true; break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } case 8: { bitField0_ |= 0x00000001; int32_ = input.readInt32(); @@ -552,6 +633,7 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } case 128: { int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") org.apache.avro.protobuf.noopt.Test.A value = org.apache.avro.protobuf.noopt.Test.A.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(16, rawValue); @@ -562,29 +644,29 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte break; } case 136: { - if (!((mutable_bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = new java.util.ArrayList(); + if (!((mutable_bitField0_ & 0x00010000) != 0)) { + intArray_ = newIntList(); mutable_bitField0_ |= 0x00010000; } - intArray_.add(input.readInt32()); + intArray_.addInt(input.readInt32()); break; } case 138: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00010000) == 0x00010000) && input.getBytesUntilLimit() > 0) { - intArray_ = new java.util.ArrayList(); + if (!((mutable_bitField0_ & 0x00010000) != 0) && input.getBytesUntilLimit() > 0) { + intArray_ = newIntList(); mutable_bitField0_ |= 0x00010000; } while (input.getBytesUntilLimit() > 0) { - intArray_.add(input.readInt32()); + intArray_.addInt(input.readInt32()); } input.popLimit(limit); break; } case 146: { org.apache.avro.protobuf.noopt.Test.Foo.Builder subBuilder = null; - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00010000) != 0)) { subBuilder = foo_.toBuilder(); } foo_ = input.readMessage(org.apache.avro.protobuf.noopt.Test.Foo.PARSER, extensionRegistry); @@ -597,11 +679,12 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } case 152: { int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") org.apache.avro.protobuf.noopt.Test.A value = org.apache.avro.protobuf.noopt.Test.A.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(19, rawValue); } else { - if (!((mutable_bitField0_ & 0x00040000) == 0x00040000)) { + if (!((mutable_bitField0_ & 0x00040000) != 0)) { syms_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00040000; } @@ -614,11 +697,12 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte int oldLimit = input.pushLimit(length); while (input.getBytesUntilLimit() > 0) { int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") org.apache.avro.protobuf.noopt.Test.A value = org.apache.avro.protobuf.noopt.Test.A.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(19, rawValue); } else { - if (!((mutable_bitField0_ & 0x00040000) == 0x00040000)) { + if (!((mutable_bitField0_ & 0x00040000) != 0)) { syms_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00040000; } @@ -629,7 +713,7 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte break; } case 162: { - if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) { + if (!((mutable_bitField0_ & 0x00020000) != 0)) { fooArray_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00020000; } @@ -638,7 +722,7 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } case 170: { com.google.protobuf.Timestamp.Builder subBuilder = null; - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { subBuilder = timestamp_.toBuilder(); } timestamp_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); @@ -649,6 +733,12 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte bitField0_ |= 0x00020000; break; } + default: { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -656,13 +746,13 @@ private Foo(com.google.protobuf.CodedInputStream input, com.google.protobuf.Exte } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { - if (((mutable_bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = java.util.Collections.unmodifiableList(intArray_); + if (((mutable_bitField0_ & 0x00010000) != 0)) { + intArray_.makeImmutable(); // C } - if (((mutable_bitField0_ & 0x00040000) == 0x00040000)) { + if (((mutable_bitField0_ & 0x00040000) != 0)) { syms_ = java.util.Collections.unmodifiableList(syms_); } - if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) { + if (((mutable_bitField0_ & 0x00020000) != 0)) { fooArray_ = java.util.Collections.unmodifiableList(fooArray_); } this.unknownFields = unknownFields.build(); @@ -674,6 +764,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_Foo_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_Foo_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.noopt.Test.Foo.class, @@ -690,9 +781,12 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF * * * required int32 int32 = 1; + * + * @return Whether the int32 field is set. */ + @java.lang.Override public boolean hasInt32() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** @@ -701,7 +795,10 @@ public boolean hasInt32() { * * * required int32 int32 = 1; + * + * @return The int32. */ + @java.lang.Override public int getInt32() { return int32_; } @@ -711,14 +808,20 @@ public int getInt32() { /** * optional int64 int64 = 2; + * + * @return Whether the int64 field is set. */ + @java.lang.Override public boolean hasInt64() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional int64 int64 = 2; + * + * @return The int64. */ + @java.lang.Override public long getInt64() { return int64_; } @@ -728,14 +831,20 @@ public long getInt64() { /** * optional uint32 uint32 = 3; + * + * @return Whether the uint32 field is set. */ + @java.lang.Override public boolean hasUint32() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000004) != 0); } /** * optional uint32 uint32 = 3; + * + * @return The uint32. */ + @java.lang.Override public int getUint32() { return uint32_; } @@ -745,14 +854,20 @@ public int getUint32() { /** * optional uint64 uint64 = 4; + * + * @return Whether the uint64 field is set. */ + @java.lang.Override public boolean hasUint64() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000008) != 0); } /** * optional uint64 uint64 = 4; + * + * @return The uint64. */ + @java.lang.Override public long getUint64() { return uint64_; } @@ -762,14 +877,20 @@ public long getUint64() { /** * optional sint32 sint32 = 5; + * + * @return Whether the sint32 field is set. */ + @java.lang.Override public boolean hasSint32() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000010) != 0); } /** * optional sint32 sint32 = 5; + * + * @return The sint32. */ + @java.lang.Override public int getSint32() { return sint32_; } @@ -779,14 +900,20 @@ public int getSint32() { /** * optional sint64 sint64 = 6; + * + * @return Whether the sint64 field is set. */ + @java.lang.Override public boolean hasSint64() { - return ((bitField0_ & 0x00000020) == 0x00000020); + return ((bitField0_ & 0x00000020) != 0); } /** * optional sint64 sint64 = 6; + * + * @return The sint64. */ + @java.lang.Override public long getSint64() { return sint64_; } @@ -796,14 +923,20 @@ public long getSint64() { /** * optional fixed32 fixed32 = 7; + * + * @return Whether the fixed32 field is set. */ + @java.lang.Override public boolean hasFixed32() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000040) != 0); } /** * optional fixed32 fixed32 = 7; + * + * @return The fixed32. */ + @java.lang.Override public int getFixed32() { return fixed32_; } @@ -813,14 +946,20 @@ public int getFixed32() { /** * optional fixed64 fixed64 = 8; + * + * @return Whether the fixed64 field is set. */ + @java.lang.Override public boolean hasFixed64() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000080) != 0); } /** * optional fixed64 fixed64 = 8; + * + * @return The fixed64. */ + @java.lang.Override public long getFixed64() { return fixed64_; } @@ -830,14 +969,20 @@ public long getFixed64() { /** * optional sfixed32 sfixed32 = 9; + * + * @return Whether the sfixed32 field is set. */ + @java.lang.Override public boolean hasSfixed32() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000100) != 0); } /** * optional sfixed32 sfixed32 = 9; + * + * @return The sfixed32. */ + @java.lang.Override public int getSfixed32() { return sfixed32_; } @@ -847,14 +992,20 @@ public int getSfixed32() { /** * optional sfixed64 sfixed64 = 10; + * + * @return Whether the sfixed64 field is set. */ + @java.lang.Override public boolean hasSfixed64() { - return ((bitField0_ & 0x00000200) == 0x00000200); + return ((bitField0_ & 0x00000200) != 0); } /** * optional sfixed64 sfixed64 = 10; + * + * @return The sfixed64. */ + @java.lang.Override public long getSfixed64() { return sfixed64_; } @@ -864,14 +1015,20 @@ public long getSfixed64() { /** * optional float float = 11; + * + * @return Whether the float field is set. */ + @java.lang.Override public boolean hasFloat() { - return ((bitField0_ & 0x00000400) == 0x00000400); + return ((bitField0_ & 0x00000400) != 0); } /** * optional float float = 11; + * + * @return The float. */ + @java.lang.Override public float getFloat() { return float_; } @@ -881,14 +1038,20 @@ public float getFloat() { /** * optional double double = 12; + * + * @return Whether the double field is set. */ + @java.lang.Override public boolean hasDouble() { - return ((bitField0_ & 0x00000800) == 0x00000800); + return ((bitField0_ & 0x00000800) != 0); } /** * optional double double = 12; + * + * @return The double. */ + @java.lang.Override public double getDouble() { return double_; } @@ -898,14 +1061,20 @@ public double getDouble() { /** * optional bool bool = 13; + * + * @return Whether the bool field is set. */ + @java.lang.Override public boolean hasBool() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00001000) != 0); } /** * optional bool bool = 13; + * + * @return The bool. */ + @java.lang.Override public boolean getBool() { return bool_; } @@ -915,14 +1084,20 @@ public boolean getBool() { /** * optional string string = 14; + * + * @return Whether the string field is set. */ + @java.lang.Override public boolean hasString() { - return ((bitField0_ & 0x00002000) == 0x00002000); + return ((bitField0_ & 0x00002000) != 0); } /** * optional string string = 14; + * + * @return The string. */ + @java.lang.Override public java.lang.String getString() { java.lang.Object ref = string_; if (ref instanceof java.lang.String) { @@ -939,7 +1114,10 @@ public java.lang.String getString() { /** * optional string string = 14; + * + * @return The bytes for string. */ + @java.lang.Override public com.google.protobuf.ByteString getStringBytes() { java.lang.Object ref = string_; if (ref instanceof java.lang.String) { @@ -956,14 +1134,20 @@ public com.google.protobuf.ByteString getStringBytes() { /** * optional bytes bytes = 15; + * + * @return Whether the bytes field is set. */ + @java.lang.Override public boolean hasBytes() { - return ((bitField0_ & 0x00004000) == 0x00004000); + return ((bitField0_ & 0x00004000) != 0); } /** * optional bytes bytes = 15; + * + * @return The bytes. */ + @java.lang.Override public com.google.protobuf.ByteString getBytes() { return bytes_; } @@ -973,21 +1157,28 @@ public com.google.protobuf.ByteString getBytes() { /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @return Whether the enum field is set. */ + @java.lang.Override public boolean hasEnum() { - return ((bitField0_ & 0x00008000) == 0x00008000); + return ((bitField0_ & 0x00008000) != 0); } /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @return The enum. */ + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.A getEnum() { + @SuppressWarnings("deprecation") org.apache.avro.protobuf.noopt.Test.A result = org.apache.avro.protobuf.noopt.Test.A.valueOf(enum_); return result == null ? org.apache.avro.protobuf.noopt.Test.A.Z : result; } public static final int INTARRAY_FIELD_NUMBER = 17; - private java.util.List intArray_; + private com.google.protobuf.Internal.IntList intArray_; /** *
@@ -995,7 +1186,10 @@ public org.apache.avro.protobuf.noopt.Test.A getEnum() {
      * 
* * repeated int32 intArray = 17; + * + * @return A list containing the intArray. */ + @java.lang.Override public java.util.List getIntArrayList() { return intArray_; } @@ -1006,6 +1200,8 @@ public java.util.List getIntArrayList() { * * * repeated int32 intArray = 17; + * + * @return The count of intArray. */ public int getIntArrayCount() { return intArray_.size(); @@ -1017,9 +1213,12 @@ public int getIntArrayCount() { * * * repeated int32 intArray = 17; + * + * @param index The index of the element to return. + * @return The intArray at the given index. */ public int getIntArray(int index) { - return intArray_.get(index); + return intArray_.getInt(index); } public static final int FOOARRAY_FIELD_NUMBER = 20; @@ -1028,6 +1227,7 @@ public int getIntArray(int index) { /** * repeated .org.apache.avro.protobuf.noopt.Foo fooArray = 20; */ + @java.lang.Override public java.util.List getFooArrayList() { return fooArray_; } @@ -1035,6 +1235,7 @@ public java.util.List getFooArrayList() /** * repeated .org.apache.avro.protobuf.noopt.Foo fooArray = 20; */ + @java.lang.Override public java.util.List getFooArrayOrBuilderList() { return fooArray_; } @@ -1042,6 +1243,7 @@ public java.util.Listrepeated .org.apache.avro.protobuf.noopt.Foo fooArray = 20; */ + @java.lang.Override public int getFooArrayCount() { return fooArray_.size(); } @@ -1049,6 +1251,7 @@ public int getFooArrayCount() { /** * repeated .org.apache.avro.protobuf.noopt.Foo fooArray = 20; */ + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.Foo getFooArray(int index) { return fooArray_.get(index); } @@ -1056,6 +1259,7 @@ public org.apache.avro.protobuf.noopt.Test.Foo getFooArray(int index) { /** * repeated .org.apache.avro.protobuf.noopt.Foo fooArray = 20; */ + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.FooOrBuilder getFooArrayOrBuilder(int index) { return fooArray_.get(index); } @@ -1064,6 +1268,7 @@ public org.apache.avro.protobuf.noopt.Test.FooOrBuilder getFooArrayOrBuilder(int private java.util.List syms_; private static final com.google.protobuf.Internal.ListAdapter.Converter syms_converter_ = new com.google.protobuf.Internal.ListAdapter.Converter() { public org.apache.avro.protobuf.noopt.Test.A convert(java.lang.Integer from) { + @SuppressWarnings("deprecation") org.apache.avro.protobuf.noopt.Test.A result = org.apache.avro.protobuf.noopt.Test.A.valueOf(from); return result == null ? org.apache.avro.protobuf.noopt.Test.A.X : result; } @@ -1071,7 +1276,10 @@ public org.apache.avro.protobuf.noopt.Test.A convert(java.lang.Integer from) { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @return A list containing the syms. */ + @java.lang.Override public java.util.List getSymsList() { return new com.google.protobuf.Internal.ListAdapter( syms_, syms_converter_); @@ -1079,14 +1287,21 @@ public java.util.List getSymsList() { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @return The count of syms. */ + @java.lang.Override public int getSymsCount() { return syms_.size(); } /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @param index The index of the element to return. + * @return The syms at the given index. */ + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.A getSyms(int index) { return syms_converter_.convert(syms_.get(index)); } @@ -1100,9 +1315,12 @@ public org.apache.avro.protobuf.noopt.Test.A getSyms(int index) { * * * optional .org.apache.avro.protobuf.noopt.Foo foo = 18; + * + * @return Whether the foo field is set. */ + @java.lang.Override public boolean hasFoo() { - return ((bitField0_ & 0x00010000) == 0x00010000); + return ((bitField0_ & 0x00010000) != 0); } /** @@ -1111,7 +1329,10 @@ public boolean hasFoo() { * * * optional .org.apache.avro.protobuf.noopt.Foo foo = 18; + * + * @return The foo. */ + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.Foo getFoo() { return foo_ == null ? org.apache.avro.protobuf.noopt.Test.Foo.getDefaultInstance() : foo_; } @@ -1123,6 +1344,7 @@ public org.apache.avro.protobuf.noopt.Test.Foo getFoo() { * * optional .org.apache.avro.protobuf.noopt.Foo foo = 18; */ + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.FooOrBuilder getFooOrBuilder() { return foo_ == null ? org.apache.avro.protobuf.noopt.Test.Foo.getDefaultInstance() : foo_; } @@ -1136,9 +1358,12 @@ public org.apache.avro.protobuf.noopt.Test.FooOrBuilder getFooOrBuilder() { * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return Whether the timestamp field is set. */ + @java.lang.Override public boolean hasTimestamp() { - return ((bitField0_ & 0x00020000) == 0x00020000); + return ((bitField0_ & 0x00020000) != 0); } /** @@ -1147,7 +1372,10 @@ public boolean hasTimestamp() { * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return The timestamp. */ + @java.lang.Override public com.google.protobuf.Timestamp getTimestamp() { return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; } @@ -1159,12 +1387,14 @@ public com.google.protobuf.Timestamp getTimestamp() { * * optional .google.protobuf.Timestamp timestamp = 21; */ + @java.lang.Override public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) @@ -1192,59 +1422,60 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeInt32(1, int32_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { output.writeInt64(2, int64_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { output.writeUInt32(3, uint32_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000008) != 0)) { output.writeUInt64(4, uint64_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000010) != 0)) { output.writeSInt32(5, sint32_); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000020) != 0)) { output.writeSInt64(6, sint64_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000040) != 0)) { output.writeFixed32(7, fixed32_); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000080) != 0)) { output.writeFixed64(8, fixed64_); } - if (((bitField0_ & 0x00000100) == 0x00000100)) { + if (((bitField0_ & 0x00000100) != 0)) { output.writeSFixed32(9, sfixed32_); } - if (((bitField0_ & 0x00000200) == 0x00000200)) { + if (((bitField0_ & 0x00000200) != 0)) { output.writeSFixed64(10, sfixed64_); } - if (((bitField0_ & 0x00000400) == 0x00000400)) { + if (((bitField0_ & 0x00000400) != 0)) { output.writeFloat(11, float_); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000800) != 0)) { output.writeDouble(12, double_); } - if (((bitField0_ & 0x00001000) == 0x00001000)) { + if (((bitField0_ & 0x00001000) != 0)) { output.writeBool(13, bool_); } - if (((bitField0_ & 0x00002000) == 0x00002000)) { + if (((bitField0_ & 0x00002000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 14, string_); } - if (((bitField0_ & 0x00004000) == 0x00004000)) { + if (((bitField0_ & 0x00004000) != 0)) { output.writeBytes(15, bytes_); } - if (((bitField0_ & 0x00008000) == 0x00008000)) { + if (((bitField0_ & 0x00008000) != 0)) { output.writeEnum(16, enum_); } for (int i = 0; i < intArray_.size(); i++) { - output.writeInt32(17, intArray_.get(i)); + output.writeInt32(17, intArray_.getInt(i)); } - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00010000) != 0)) { output.writeMessage(18, getFoo()); } for (int i = 0; i < syms_.size(); i++) { @@ -1253,75 +1484,76 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < fooArray_.size(); i++) { output.writeMessage(20, fooArray_.get(i)); } - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { output.writeMessage(21, getTimestamp()); } unknownFields.writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, int32_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, int64_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.CodedOutputStream.computeUInt32Size(3, uint32_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000008) != 0)) { size += com.google.protobuf.CodedOutputStream.computeUInt64Size(4, uint64_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000010) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSInt32Size(5, sint32_); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000020) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSInt64Size(6, sint64_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000040) != 0)) { size += com.google.protobuf.CodedOutputStream.computeFixed32Size(7, fixed32_); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000080) != 0)) { size += com.google.protobuf.CodedOutputStream.computeFixed64Size(8, fixed64_); } - if (((bitField0_ & 0x00000100) == 0x00000100)) { + if (((bitField0_ & 0x00000100) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSFixed32Size(9, sfixed32_); } - if (((bitField0_ & 0x00000200) == 0x00000200)) { + if (((bitField0_ & 0x00000200) != 0)) { size += com.google.protobuf.CodedOutputStream.computeSFixed64Size(10, sfixed64_); } - if (((bitField0_ & 0x00000400) == 0x00000400)) { + if (((bitField0_ & 0x00000400) != 0)) { size += com.google.protobuf.CodedOutputStream.computeFloatSize(11, float_); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000800) != 0)) { size += com.google.protobuf.CodedOutputStream.computeDoubleSize(12, double_); } - if (((bitField0_ & 0x00001000) == 0x00001000)) { + if (((bitField0_ & 0x00001000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(13, bool_); } - if (((bitField0_ & 0x00002000) == 0x00002000)) { + if (((bitField0_ & 0x00002000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, string_); } - if (((bitField0_ & 0x00004000) == 0x00004000)) { + if (((bitField0_ & 0x00004000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(15, bytes_); } - if (((bitField0_ & 0x00008000) == 0x00008000)) { + if (((bitField0_ & 0x00008000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(16, enum_); } { int dataSize = 0; for (int i = 0; i < intArray_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(intArray_.get(i)); + dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(intArray_.getInt(i)); } size += dataSize; size += 2 * getIntArrayList().size(); } - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00010000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(18, getFoo()); } { @@ -1335,7 +1567,7 @@ public int getSerializedSize() { for (int i = 0; i < fooArray_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(20, fooArray_.get(i)); } - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(21, getTimestamp()); } size += unknownFields.getSerializedSize(); @@ -1353,86 +1585,123 @@ public boolean equals(final java.lang.Object obj) { } org.apache.avro.protobuf.noopt.Test.Foo other = (org.apache.avro.protobuf.noopt.Test.Foo) obj; - boolean result = true; - result = result && (hasInt32() == other.hasInt32()); + if (hasInt32() != other.hasInt32()) + return false; if (hasInt32()) { - result = result && (getInt32() == other.getInt32()); + if (getInt32() != other.getInt32()) + return false; } - result = result && (hasInt64() == other.hasInt64()); + if (hasInt64() != other.hasInt64()) + return false; if (hasInt64()) { - result = result && (getInt64() == other.getInt64()); + if (getInt64() != other.getInt64()) + return false; } - result = result && (hasUint32() == other.hasUint32()); + if (hasUint32() != other.hasUint32()) + return false; if (hasUint32()) { - result = result && (getUint32() == other.getUint32()); + if (getUint32() != other.getUint32()) + return false; } - result = result && (hasUint64() == other.hasUint64()); + if (hasUint64() != other.hasUint64()) + return false; if (hasUint64()) { - result = result && (getUint64() == other.getUint64()); + if (getUint64() != other.getUint64()) + return false; } - result = result && (hasSint32() == other.hasSint32()); + if (hasSint32() != other.hasSint32()) + return false; if (hasSint32()) { - result = result && (getSint32() == other.getSint32()); + if (getSint32() != other.getSint32()) + return false; } - result = result && (hasSint64() == other.hasSint64()); + if (hasSint64() != other.hasSint64()) + return false; if (hasSint64()) { - result = result && (getSint64() == other.getSint64()); + if (getSint64() != other.getSint64()) + return false; } - result = result && (hasFixed32() == other.hasFixed32()); + if (hasFixed32() != other.hasFixed32()) + return false; if (hasFixed32()) { - result = result && (getFixed32() == other.getFixed32()); + if (getFixed32() != other.getFixed32()) + return false; } - result = result && (hasFixed64() == other.hasFixed64()); + if (hasFixed64() != other.hasFixed64()) + return false; if (hasFixed64()) { - result = result && (getFixed64() == other.getFixed64()); + if (getFixed64() != other.getFixed64()) + return false; } - result = result && (hasSfixed32() == other.hasSfixed32()); + if (hasSfixed32() != other.hasSfixed32()) + return false; if (hasSfixed32()) { - result = result && (getSfixed32() == other.getSfixed32()); + if (getSfixed32() != other.getSfixed32()) + return false; } - result = result && (hasSfixed64() == other.hasSfixed64()); + if (hasSfixed64() != other.hasSfixed64()) + return false; if (hasSfixed64()) { - result = result && (getSfixed64() == other.getSfixed64()); + if (getSfixed64() != other.getSfixed64()) + return false; } - result = result && (hasFloat() == other.hasFloat()); + if (hasFloat() != other.hasFloat()) + return false; if (hasFloat()) { - result = result - && (java.lang.Float.floatToIntBits(getFloat()) == java.lang.Float.floatToIntBits(other.getFloat())); + if (java.lang.Float.floatToIntBits(getFloat()) != java.lang.Float.floatToIntBits(other.getFloat())) + return false; } - result = result && (hasDouble() == other.hasDouble()); + if (hasDouble() != other.hasDouble()) + return false; if (hasDouble()) { - result = result - && (java.lang.Double.doubleToLongBits(getDouble()) == java.lang.Double.doubleToLongBits(other.getDouble())); + if (java.lang.Double.doubleToLongBits(getDouble()) != java.lang.Double.doubleToLongBits(other.getDouble())) + return false; } - result = result && (hasBool() == other.hasBool()); + if (hasBool() != other.hasBool()) + return false; if (hasBool()) { - result = result && (getBool() == other.getBool()); + if (getBool() != other.getBool()) + return false; } - result = result && (hasString() == other.hasString()); + if (hasString() != other.hasString()) + return false; if (hasString()) { - result = result && getString().equals(other.getString()); + if (!getString().equals(other.getString())) + return false; } - result = result && (hasBytes() == other.hasBytes()); + if (hasBytes() != other.hasBytes()) + return false; if (hasBytes()) { - result = result && getBytes().equals(other.getBytes()); + if (!getBytes().equals(other.getBytes())) + return false; } - result = result && (hasEnum() == other.hasEnum()); + if (hasEnum() != other.hasEnum()) + return false; if (hasEnum()) { - result = result && enum_ == other.enum_; + if (enum_ != other.enum_) + return false; } - result = result && getIntArrayList().equals(other.getIntArrayList()); - result = result && getFooArrayList().equals(other.getFooArrayList()); - result = result && syms_.equals(other.syms_); - result = result && (hasFoo() == other.hasFoo()); + if (!getIntArrayList().equals(other.getIntArrayList())) + return false; + if (!getFooArrayList().equals(other.getFooArrayList())) + return false; + if (!syms_.equals(other.syms_)) + return false; + if (hasFoo() != other.hasFoo()) + return false; if (hasFoo()) { - result = result && getFoo().equals(other.getFoo()); + if (!getFoo().equals(other.getFoo())) + return false; } - result = result && (hasTimestamp() == other.hasTimestamp()); + if (hasTimestamp() != other.hasTimestamp()) + return false; if (hasTimestamp()) { - result = result && getTimestamp().equals(other.getTimestamp()); + if (!getTimestamp().equals(other.getTimestamp())) + return false; } - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!unknownFields.equals(other.unknownFields)) + return false; + return true; } @java.lang.Override @@ -1594,6 +1863,7 @@ public static org.apache.avro.protobuf.noopt.Test.Foo parseFrom(com.google.proto return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } @@ -1606,6 +1876,7 @@ public static Builder newBuilder(org.apache.avro.protobuf.noopt.Test.Foo prototy return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @@ -1626,6 +1897,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_Foo_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_Foo_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.noopt.Test.Foo.class, @@ -1650,6 +1922,7 @@ private void maybeForceBuilderInitialization() { } } + @java.lang.Override public Builder clear() { super.clear(); int32_ = 0; @@ -1684,7 +1957,7 @@ public Builder clear() { bitField0_ = (bitField0_ & ~0x00004000); enum_ = 3; bitField0_ = (bitField0_ & ~0x00008000); - intArray_ = java.util.Collections.emptyList(); + intArray_ = emptyIntList(); bitField0_ = (bitField0_ & ~0x00010000); if (fooArrayBuilder_ == null) { fooArray_ = java.util.Collections.emptyList(); @@ -1709,14 +1982,17 @@ public Builder clear() { return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_Foo_descriptor; } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.Foo getDefaultInstanceForType() { return org.apache.avro.protobuf.noopt.Test.Foo.getDefaultInstance(); } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.Foo build() { org.apache.avro.protobuf.noopt.Test.Foo result = buildPartial(); if (!result.isInitialized()) { @@ -1725,81 +2001,82 @@ public org.apache.avro.protobuf.noopt.Test.Foo build() { return result; } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.Foo buildPartial() { org.apache.avro.protobuf.noopt.Test.Foo result = new org.apache.avro.protobuf.noopt.Test.Foo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + if (((from_bitField0_ & 0x00000001) != 0)) { + result.int32_ = int32_; to_bitField0_ |= 0x00000001; } - result.int32_ = int32_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + if (((from_bitField0_ & 0x00000002) != 0)) { + result.int64_ = int64_; to_bitField0_ |= 0x00000002; } - result.int64_ = int64_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + if (((from_bitField0_ & 0x00000004) != 0)) { + result.uint32_ = uint32_; to_bitField0_ |= 0x00000004; } - result.uint32_ = uint32_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + if (((from_bitField0_ & 0x00000008) != 0)) { + result.uint64_ = uint64_; to_bitField0_ |= 0x00000008; } - result.uint64_ = uint64_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + if (((from_bitField0_ & 0x00000010) != 0)) { + result.sint32_ = sint32_; to_bitField0_ |= 0x00000010; } - result.sint32_ = sint32_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + if (((from_bitField0_ & 0x00000020) != 0)) { + result.sint64_ = sint64_; to_bitField0_ |= 0x00000020; } - result.sint64_ = sint64_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + if (((from_bitField0_ & 0x00000040) != 0)) { + result.fixed32_ = fixed32_; to_bitField0_ |= 0x00000040; } - result.fixed32_ = fixed32_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + if (((from_bitField0_ & 0x00000080) != 0)) { + result.fixed64_ = fixed64_; to_bitField0_ |= 0x00000080; } - result.fixed64_ = fixed64_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + if (((from_bitField0_ & 0x00000100) != 0)) { + result.sfixed32_ = sfixed32_; to_bitField0_ |= 0x00000100; } - result.sfixed32_ = sfixed32_; - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + if (((from_bitField0_ & 0x00000200) != 0)) { + result.sfixed64_ = sfixed64_; to_bitField0_ |= 0x00000200; } - result.sfixed64_ = sfixed64_; - if (((from_bitField0_ & 0x00000400) == 0x00000400)) { + if (((from_bitField0_ & 0x00000400) != 0)) { + result.float_ = float_; to_bitField0_ |= 0x00000400; } - result.float_ = float_; - if (((from_bitField0_ & 0x00000800) == 0x00000800)) { + if (((from_bitField0_ & 0x00000800) != 0)) { + result.double_ = double_; to_bitField0_ |= 0x00000800; } - result.double_ = double_; - if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + if (((from_bitField0_ & 0x00001000) != 0)) { + result.bool_ = bool_; to_bitField0_ |= 0x00001000; } - result.bool_ = bool_; - if (((from_bitField0_ & 0x00002000) == 0x00002000)) { + if (((from_bitField0_ & 0x00002000) != 0)) { to_bitField0_ |= 0x00002000; } result.string_ = string_; - if (((from_bitField0_ & 0x00004000) == 0x00004000)) { + if (((from_bitField0_ & 0x00004000) != 0)) { to_bitField0_ |= 0x00004000; } result.bytes_ = bytes_; - if (((from_bitField0_ & 0x00008000) == 0x00008000)) { + if (((from_bitField0_ & 0x00008000) != 0)) { to_bitField0_ |= 0x00008000; } result.enum_ = enum_; - if (((bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = java.util.Collections.unmodifiableList(intArray_); + if (((bitField0_ & 0x00010000) != 0)) { + intArray_.makeImmutable(); bitField0_ = (bitField0_ & ~0x00010000); } result.intArray_ = intArray_; if (fooArrayBuilder_ == null) { - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00020000) != 0)) { fooArray_ = java.util.Collections.unmodifiableList(fooArray_); bitField0_ = (bitField0_ & ~0x00020000); } @@ -1807,57 +2084,64 @@ public org.apache.avro.protobuf.noopt.Test.Foo buildPartial() { } else { result.fooArray_ = fooArrayBuilder_.build(); } - if (((bitField0_ & 0x00040000) == 0x00040000)) { + if (((bitField0_ & 0x00040000) != 0)) { syms_ = java.util.Collections.unmodifiableList(syms_); bitField0_ = (bitField0_ & ~0x00040000); } result.syms_ = syms_; - if (((from_bitField0_ & 0x00080000) == 0x00080000)) { + if (((from_bitField0_ & 0x00080000) != 0)) { + if (fooBuilder_ == null) { + result.foo_ = foo_; + } else { + result.foo_ = fooBuilder_.build(); + } to_bitField0_ |= 0x00010000; } - if (fooBuilder_ == null) { - result.foo_ = foo_; - } else { - result.foo_ = fooBuilder_.build(); - } - if (((from_bitField0_ & 0x00100000) == 0x00100000)) { + if (((from_bitField0_ & 0x00100000) != 0)) { + if (timestampBuilder_ == null) { + result.timestamp_ = timestamp_; + } else { + result.timestamp_ = timestampBuilder_.build(); + } to_bitField0_ |= 0x00020000; } - if (timestampBuilder_ == null) { - result.timestamp_ = timestamp_; - } else { - result.timestamp_ = timestampBuilder_.build(); - } result.bitField0_ = to_bitField0_; onBuilt(); return result; } + @java.lang.Override public Builder clone() { - return (Builder) super.clone(); + return super.clone(); } + @java.lang.Override public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.setField(field, value); + return super.setField(field, value); } + @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); + return super.clearField(field); } + @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); + return super.clearOneof(oneof); } + @java.lang.Override public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); + return super.setRepeatedField(field, index, value); } + @java.lang.Override public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); + return super.addRepeatedField(field, value); } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.apache.avro.protobuf.noopt.Test.Foo) { return mergeFrom((org.apache.avro.protobuf.noopt.Test.Foo) other); @@ -1977,6 +2261,7 @@ public Builder mergeFrom(org.apache.avro.protobuf.noopt.Test.Foo other) { return this; } + @java.lang.Override public final boolean isInitialized() { if (!hasInt32()) { return false; @@ -1994,6 +2279,7 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.apache.avro.protobuf.noopt.Test.Foo parsedMessage = null; @@ -2020,9 +2306,12 @@ public Builder mergeFrom(com.google.protobuf.CodedInputStream input, * * * required int32 int32 = 1; + * + * @return Whether the int32 field is set. */ + @java.lang.Override public boolean hasInt32() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** @@ -2031,7 +2320,10 @@ public boolean hasInt32() { * * * required int32 int32 = 1; + * + * @return The int32. */ + @java.lang.Override public int getInt32() { return int32_; } @@ -2042,6 +2334,9 @@ public int getInt32() { * * * required int32 int32 = 1; + * + * @param value The int32 to set. + * @return This builder for chaining. */ public Builder setInt32(int value) { bitField0_ |= 0x00000001; @@ -2056,6 +2351,8 @@ public Builder setInt32(int value) { * * * required int32 int32 = 1; + * + * @return This builder for chaining. */ public Builder clearInt32() { bitField0_ = (bitField0_ & ~0x00000001); @@ -2068,20 +2365,29 @@ public Builder clearInt32() { /** * optional int64 int64 = 2; + * + * @return Whether the int64 field is set. */ + @java.lang.Override public boolean hasInt64() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional int64 int64 = 2; + * + * @return The int64. */ + @java.lang.Override public long getInt64() { return int64_; } /** * optional int64 int64 = 2; + * + * @param value The int64 to set. + * @return This builder for chaining. */ public Builder setInt64(long value) { bitField0_ |= 0x00000002; @@ -2092,6 +2398,8 @@ public Builder setInt64(long value) { /** * optional int64 int64 = 2; + * + * @return This builder for chaining. */ public Builder clearInt64() { bitField0_ = (bitField0_ & ~0x00000002); @@ -2104,20 +2412,29 @@ public Builder clearInt64() { /** * optional uint32 uint32 = 3; + * + * @return Whether the uint32 field is set. */ + @java.lang.Override public boolean hasUint32() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000004) != 0); } /** * optional uint32 uint32 = 3; + * + * @return The uint32. */ + @java.lang.Override public int getUint32() { return uint32_; } /** * optional uint32 uint32 = 3; + * + * @param value The uint32 to set. + * @return This builder for chaining. */ public Builder setUint32(int value) { bitField0_ |= 0x00000004; @@ -2128,6 +2445,8 @@ public Builder setUint32(int value) { /** * optional uint32 uint32 = 3; + * + * @return This builder for chaining. */ public Builder clearUint32() { bitField0_ = (bitField0_ & ~0x00000004); @@ -2140,20 +2459,29 @@ public Builder clearUint32() { /** * optional uint64 uint64 = 4; + * + * @return Whether the uint64 field is set. */ + @java.lang.Override public boolean hasUint64() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000008) != 0); } /** * optional uint64 uint64 = 4; + * + * @return The uint64. */ + @java.lang.Override public long getUint64() { return uint64_; } /** * optional uint64 uint64 = 4; + * + * @param value The uint64 to set. + * @return This builder for chaining. */ public Builder setUint64(long value) { bitField0_ |= 0x00000008; @@ -2164,6 +2492,8 @@ public Builder setUint64(long value) { /** * optional uint64 uint64 = 4; + * + * @return This builder for chaining. */ public Builder clearUint64() { bitField0_ = (bitField0_ & ~0x00000008); @@ -2176,20 +2506,29 @@ public Builder clearUint64() { /** * optional sint32 sint32 = 5; + * + * @return Whether the sint32 field is set. */ + @java.lang.Override public boolean hasSint32() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000010) != 0); } /** * optional sint32 sint32 = 5; + * + * @return The sint32. */ + @java.lang.Override public int getSint32() { return sint32_; } /** * optional sint32 sint32 = 5; + * + * @param value The sint32 to set. + * @return This builder for chaining. */ public Builder setSint32(int value) { bitField0_ |= 0x00000010; @@ -2200,6 +2539,8 @@ public Builder setSint32(int value) { /** * optional sint32 sint32 = 5; + * + * @return This builder for chaining. */ public Builder clearSint32() { bitField0_ = (bitField0_ & ~0x00000010); @@ -2212,20 +2553,29 @@ public Builder clearSint32() { /** * optional sint64 sint64 = 6; + * + * @return Whether the sint64 field is set. */ + @java.lang.Override public boolean hasSint64() { - return ((bitField0_ & 0x00000020) == 0x00000020); + return ((bitField0_ & 0x00000020) != 0); } /** * optional sint64 sint64 = 6; + * + * @return The sint64. */ + @java.lang.Override public long getSint64() { return sint64_; } /** * optional sint64 sint64 = 6; + * + * @param value The sint64 to set. + * @return This builder for chaining. */ public Builder setSint64(long value) { bitField0_ |= 0x00000020; @@ -2236,6 +2586,8 @@ public Builder setSint64(long value) { /** * optional sint64 sint64 = 6; + * + * @return This builder for chaining. */ public Builder clearSint64() { bitField0_ = (bitField0_ & ~0x00000020); @@ -2248,20 +2600,29 @@ public Builder clearSint64() { /** * optional fixed32 fixed32 = 7; + * + * @return Whether the fixed32 field is set. */ + @java.lang.Override public boolean hasFixed32() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000040) != 0); } /** * optional fixed32 fixed32 = 7; + * + * @return The fixed32. */ + @java.lang.Override public int getFixed32() { return fixed32_; } /** * optional fixed32 fixed32 = 7; + * + * @param value The fixed32 to set. + * @return This builder for chaining. */ public Builder setFixed32(int value) { bitField0_ |= 0x00000040; @@ -2272,6 +2633,8 @@ public Builder setFixed32(int value) { /** * optional fixed32 fixed32 = 7; + * + * @return This builder for chaining. */ public Builder clearFixed32() { bitField0_ = (bitField0_ & ~0x00000040); @@ -2284,20 +2647,29 @@ public Builder clearFixed32() { /** * optional fixed64 fixed64 = 8; + * + * @return Whether the fixed64 field is set. */ + @java.lang.Override public boolean hasFixed64() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000080) != 0); } /** * optional fixed64 fixed64 = 8; + * + * @return The fixed64. */ + @java.lang.Override public long getFixed64() { return fixed64_; } /** * optional fixed64 fixed64 = 8; + * + * @param value The fixed64 to set. + * @return This builder for chaining. */ public Builder setFixed64(long value) { bitField0_ |= 0x00000080; @@ -2308,6 +2680,8 @@ public Builder setFixed64(long value) { /** * optional fixed64 fixed64 = 8; + * + * @return This builder for chaining. */ public Builder clearFixed64() { bitField0_ = (bitField0_ & ~0x00000080); @@ -2320,20 +2694,29 @@ public Builder clearFixed64() { /** * optional sfixed32 sfixed32 = 9; + * + * @return Whether the sfixed32 field is set. */ + @java.lang.Override public boolean hasSfixed32() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000100) != 0); } /** * optional sfixed32 sfixed32 = 9; + * + * @return The sfixed32. */ + @java.lang.Override public int getSfixed32() { return sfixed32_; } /** * optional sfixed32 sfixed32 = 9; + * + * @param value The sfixed32 to set. + * @return This builder for chaining. */ public Builder setSfixed32(int value) { bitField0_ |= 0x00000100; @@ -2344,6 +2727,8 @@ public Builder setSfixed32(int value) { /** * optional sfixed32 sfixed32 = 9; + * + * @return This builder for chaining. */ public Builder clearSfixed32() { bitField0_ = (bitField0_ & ~0x00000100); @@ -2356,20 +2741,29 @@ public Builder clearSfixed32() { /** * optional sfixed64 sfixed64 = 10; + * + * @return Whether the sfixed64 field is set. */ + @java.lang.Override public boolean hasSfixed64() { - return ((bitField0_ & 0x00000200) == 0x00000200); + return ((bitField0_ & 0x00000200) != 0); } /** * optional sfixed64 sfixed64 = 10; + * + * @return The sfixed64. */ + @java.lang.Override public long getSfixed64() { return sfixed64_; } /** * optional sfixed64 sfixed64 = 10; + * + * @param value The sfixed64 to set. + * @return This builder for chaining. */ public Builder setSfixed64(long value) { bitField0_ |= 0x00000200; @@ -2380,6 +2774,8 @@ public Builder setSfixed64(long value) { /** * optional sfixed64 sfixed64 = 10; + * + * @return This builder for chaining. */ public Builder clearSfixed64() { bitField0_ = (bitField0_ & ~0x00000200); @@ -2392,20 +2788,29 @@ public Builder clearSfixed64() { /** * optional float float = 11; + * + * @return Whether the float field is set. */ + @java.lang.Override public boolean hasFloat() { - return ((bitField0_ & 0x00000400) == 0x00000400); + return ((bitField0_ & 0x00000400) != 0); } /** * optional float float = 11; + * + * @return The float. */ + @java.lang.Override public float getFloat() { return float_; } /** * optional float float = 11; + * + * @param value The float to set. + * @return This builder for chaining. */ public Builder setFloat(float value) { bitField0_ |= 0x00000400; @@ -2416,6 +2821,8 @@ public Builder setFloat(float value) { /** * optional float float = 11; + * + * @return This builder for chaining. */ public Builder clearFloat() { bitField0_ = (bitField0_ & ~0x00000400); @@ -2428,20 +2835,29 @@ public Builder clearFloat() { /** * optional double double = 12; + * + * @return Whether the double field is set. */ + @java.lang.Override public boolean hasDouble() { - return ((bitField0_ & 0x00000800) == 0x00000800); + return ((bitField0_ & 0x00000800) != 0); } /** * optional double double = 12; + * + * @return The double. */ + @java.lang.Override public double getDouble() { return double_; } /** * optional double double = 12; + * + * @param value The double to set. + * @return This builder for chaining. */ public Builder setDouble(double value) { bitField0_ |= 0x00000800; @@ -2452,6 +2868,8 @@ public Builder setDouble(double value) { /** * optional double double = 12; + * + * @return This builder for chaining. */ public Builder clearDouble() { bitField0_ = (bitField0_ & ~0x00000800); @@ -2464,20 +2882,29 @@ public Builder clearDouble() { /** * optional bool bool = 13; + * + * @return Whether the bool field is set. */ + @java.lang.Override public boolean hasBool() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00001000) != 0); } /** * optional bool bool = 13; + * + * @return The bool. */ + @java.lang.Override public boolean getBool() { return bool_; } /** * optional bool bool = 13; + * + * @param value The bool to set. + * @return This builder for chaining. */ public Builder setBool(boolean value) { bitField0_ |= 0x00001000; @@ -2488,6 +2915,8 @@ public Builder setBool(boolean value) { /** * optional bool bool = 13; + * + * @return This builder for chaining. */ public Builder clearBool() { bitField0_ = (bitField0_ & ~0x00001000); @@ -2500,13 +2929,17 @@ public Builder clearBool() { /** * optional string string = 14; + * + * @return Whether the string field is set. */ public boolean hasString() { - return ((bitField0_ & 0x00002000) == 0x00002000); + return ((bitField0_ & 0x00002000) != 0); } /** * optional string string = 14; + * + * @return The string. */ public java.lang.String getString() { java.lang.Object ref = string_; @@ -2524,6 +2957,8 @@ public java.lang.String getString() { /** * optional string string = 14; + * + * @return The bytes for string. */ public com.google.protobuf.ByteString getStringBytes() { java.lang.Object ref = string_; @@ -2538,6 +2973,9 @@ public com.google.protobuf.ByteString getStringBytes() { /** * optional string string = 14; + * + * @param value The string to set. + * @return This builder for chaining. */ public Builder setString(java.lang.String value) { if (value == null) { @@ -2551,6 +2989,8 @@ public Builder setString(java.lang.String value) { /** * optional string string = 14; + * + * @return This builder for chaining. */ public Builder clearString() { bitField0_ = (bitField0_ & ~0x00002000); @@ -2561,6 +3001,9 @@ public Builder clearString() { /** * optional string string = 14; + * + * @param value The bytes for string to set. + * @return This builder for chaining. */ public Builder setStringBytes(com.google.protobuf.ByteString value) { if (value == null) { @@ -2576,20 +3019,29 @@ public Builder setStringBytes(com.google.protobuf.ByteString value) { /** * optional bytes bytes = 15; + * + * @return Whether the bytes field is set. */ + @java.lang.Override public boolean hasBytes() { - return ((bitField0_ & 0x00004000) == 0x00004000); + return ((bitField0_ & 0x00004000) != 0); } /** * optional bytes bytes = 15; + * + * @return The bytes. */ + @java.lang.Override public com.google.protobuf.ByteString getBytes() { return bytes_; } /** * optional bytes bytes = 15; + * + * @param value The bytes to set. + * @return This builder for chaining. */ public Builder setBytes(com.google.protobuf.ByteString value) { if (value == null) { @@ -2603,6 +3055,8 @@ public Builder setBytes(com.google.protobuf.ByteString value) { /** * optional bytes bytes = 15; + * + * @return This builder for chaining. */ public Builder clearBytes() { bitField0_ = (bitField0_ & ~0x00004000); @@ -2615,21 +3069,31 @@ public Builder clearBytes() { /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @return Whether the enum field is set. */ + @java.lang.Override public boolean hasEnum() { - return ((bitField0_ & 0x00008000) == 0x00008000); + return ((bitField0_ & 0x00008000) != 0); } /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @return The enum. */ + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.A getEnum() { + @SuppressWarnings("deprecation") org.apache.avro.protobuf.noopt.Test.A result = org.apache.avro.protobuf.noopt.Test.A.valueOf(enum_); return result == null ? org.apache.avro.protobuf.noopt.Test.A.Z : result; } /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @param value The enum to set. + * @return This builder for chaining. */ public Builder setEnum(org.apache.avro.protobuf.noopt.Test.A value) { if (value == null) { @@ -2643,6 +3107,8 @@ public Builder setEnum(org.apache.avro.protobuf.noopt.Test.A value) { /** * optional .org.apache.avro.protobuf.noopt.A enum = 16 [default = Z]; + * + * @return This builder for chaining. */ public Builder clearEnum() { bitField0_ = (bitField0_ & ~0x00008000); @@ -2651,11 +3117,11 @@ public Builder clearEnum() { return this; } - private java.util.List intArray_ = java.util.Collections.emptyList(); + private com.google.protobuf.Internal.IntList intArray_ = emptyIntList(); private void ensureIntArrayIsMutable() { - if (!((bitField0_ & 0x00010000) == 0x00010000)) { - intArray_ = new java.util.ArrayList(intArray_); + if (!((bitField0_ & 0x00010000) != 0)) { + intArray_ = mutableCopy(intArray_); bitField0_ |= 0x00010000; } } @@ -2666,9 +3132,11 @@ private void ensureIntArrayIsMutable() { * * * repeated int32 intArray = 17; + * + * @return A list containing the intArray. */ public java.util.List getIntArrayList() { - return java.util.Collections.unmodifiableList(intArray_); + return ((bitField0_ & 0x00010000) != 0) ? java.util.Collections.unmodifiableList(intArray_) : intArray_; } /** @@ -2677,6 +3145,8 @@ public java.util.List getIntArrayList() { * * * repeated int32 intArray = 17; + * + * @return The count of intArray. */ public int getIntArrayCount() { return intArray_.size(); @@ -2688,9 +3158,12 @@ public int getIntArrayCount() { * * * repeated int32 intArray = 17; + * + * @param index The index of the element to return. + * @return The intArray at the given index. */ public int getIntArray(int index) { - return intArray_.get(index); + return intArray_.getInt(index); } /** @@ -2699,10 +3172,14 @@ public int getIntArray(int index) { * * * repeated int32 intArray = 17; + * + * @param index The index to set the value at. + * @param value The intArray to set. + * @return This builder for chaining. */ public Builder setIntArray(int index, int value) { ensureIntArrayIsMutable(); - intArray_.set(index, value); + intArray_.setInt(index, value); onChanged(); return this; } @@ -2713,10 +3190,13 @@ public Builder setIntArray(int index, int value) { * * * repeated int32 intArray = 17; + * + * @param value The intArray to add. + * @return This builder for chaining. */ public Builder addIntArray(int value) { ensureIntArrayIsMutable(); - intArray_.add(value); + intArray_.addInt(value); onChanged(); return this; } @@ -2727,6 +3207,9 @@ public Builder addIntArray(int value) { * * * repeated int32 intArray = 17; + * + * @param values The intArray to add. + * @return This builder for chaining. */ public Builder addAllIntArray(java.lang.Iterable values) { ensureIntArrayIsMutable(); @@ -2741,9 +3224,11 @@ public Builder addAllIntArray(java.lang.Iterable va * * * repeated int32 intArray = 17; + * + * @return This builder for chaining. */ public Builder clearIntArray() { - intArray_ = java.util.Collections.emptyList(); + intArray_ = emptyIntList(); bitField0_ = (bitField0_ & ~0x00010000); onChanged(); return this; @@ -2752,7 +3237,7 @@ public Builder clearIntArray() { private java.util.List fooArray_ = java.util.Collections.emptyList(); private void ensureFooArrayIsMutable() { - if (!((bitField0_ & 0x00020000) == 0x00020000)) { + if (!((bitField0_ & 0x00020000) != 0)) { fooArray_ = new java.util.ArrayList(fooArray_); bitField0_ |= 0x00020000; } @@ -2982,7 +3467,7 @@ public java.util.List getFooArr private com.google.protobuf.RepeatedFieldBuilderV3 getFooArrayFieldBuilder() { if (fooArrayBuilder_ == null) { fooArrayBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3( - fooArray_, ((bitField0_ & 0x00020000) == 0x00020000), getParentForChildren(), isClean()); + fooArray_, ((bitField0_ & 0x00020000) != 0), getParentForChildren(), isClean()); fooArray_ = null; } return fooArrayBuilder_; @@ -2991,7 +3476,7 @@ private com.google.protobuf.RepeatedFieldBuilderV3 syms_ = java.util.Collections.emptyList(); private void ensureSymsIsMutable() { - if (!((bitField0_ & 0x00040000) == 0x00040000)) { + if (!((bitField0_ & 0x00040000) != 0)) { syms_ = new java.util.ArrayList(syms_); bitField0_ |= 0x00040000; } @@ -2999,6 +3484,8 @@ private void ensureSymsIsMutable() { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @return A list containing the syms. */ public java.util.List getSymsList() { return new com.google.protobuf.Internal.ListAdapter( @@ -3007,6 +3494,8 @@ public java.util.List getSymsList() { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @return The count of syms. */ public int getSymsCount() { return syms_.size(); @@ -3014,6 +3503,9 @@ public int getSymsCount() { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @param index The index of the element to return. + * @return The syms at the given index. */ public org.apache.avro.protobuf.noopt.Test.A getSyms(int index) { return syms_converter_.convert(syms_.get(index)); @@ -3021,6 +3513,10 @@ public org.apache.avro.protobuf.noopt.Test.A getSyms(int index) { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @param index The index to set the value at. + * @param value The syms to set. + * @return This builder for chaining. */ public Builder setSyms(int index, org.apache.avro.protobuf.noopt.Test.A value) { if (value == null) { @@ -3034,6 +3530,9 @@ public Builder setSyms(int index, org.apache.avro.protobuf.noopt.Test.A value) { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @param value The syms to add. + * @return This builder for chaining. */ public Builder addSyms(org.apache.avro.protobuf.noopt.Test.A value) { if (value == null) { @@ -3047,6 +3546,9 @@ public Builder addSyms(org.apache.avro.protobuf.noopt.Test.A value) { /** * repeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @param values The syms to add. + * @return This builder for chaining. */ public Builder addAllSyms(java.lang.Iterable values) { ensureSymsIsMutable(); @@ -3059,6 +3561,8 @@ public Builder addAllSyms(java.lang.Iterablerepeated .org.apache.avro.protobuf.noopt.A syms = 19; + * + * @return This builder for chaining. */ public Builder clearSyms() { syms_ = java.util.Collections.emptyList(); @@ -3067,7 +3571,7 @@ public Builder clearSyms() { return this; } - private org.apache.avro.protobuf.noopt.Test.Foo foo_ = null; + private org.apache.avro.protobuf.noopt.Test.Foo foo_; private com.google.protobuf.SingleFieldBuilderV3 fooBuilder_; /** @@ -3076,9 +3580,11 @@ public Builder clearSyms() { * * * optional .org.apache.avro.protobuf.noopt.Foo foo = 18; + * + * @return Whether the foo field is set. */ public boolean hasFoo() { - return ((bitField0_ & 0x00080000) == 0x00080000); + return ((bitField0_ & 0x00080000) != 0); } /** @@ -3087,6 +3593,8 @@ public boolean hasFoo() { * * * optional .org.apache.avro.protobuf.noopt.Foo foo = 18; + * + * @return The foo. */ public org.apache.avro.protobuf.noopt.Test.Foo getFoo() { if (fooBuilder_ == null) { @@ -3144,7 +3652,7 @@ public Builder setFoo(org.apache.avro.protobuf.noopt.Test.Foo.Builder builderFor */ public Builder mergeFoo(org.apache.avro.protobuf.noopt.Test.Foo value) { if (fooBuilder_ == null) { - if (((bitField0_ & 0x00080000) == 0x00080000) && foo_ != null + if (((bitField0_ & 0x00080000) != 0) && foo_ != null && foo_ != org.apache.avro.protobuf.noopt.Test.Foo.getDefaultInstance()) { foo_ = org.apache.avro.protobuf.noopt.Test.Foo.newBuilder(foo_).mergeFrom(value).buildPartial(); } else { @@ -3220,7 +3728,7 @@ private com.google.protobuf.SingleFieldBuilderV3 timestampBuilder_; /** @@ -3229,9 +3737,11 @@ private com.google.protobuf.SingleFieldBuilderV3 * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return Whether the timestamp field is set. */ public boolean hasTimestamp() { - return ((bitField0_ & 0x00100000) == 0x00100000); + return ((bitField0_ & 0x00100000) != 0); } /** @@ -3240,6 +3750,8 @@ public boolean hasTimestamp() { * * * optional .google.protobuf.Timestamp timestamp = 21; + * + * @return The timestamp. */ public com.google.protobuf.Timestamp getTimestamp() { if (timestampBuilder_ == null) { @@ -3297,7 +3809,7 @@ public Builder setTimestamp(com.google.protobuf.Timestamp.Builder builderForValu */ public Builder mergeTimestamp(com.google.protobuf.Timestamp value) { if (timestampBuilder_ == null) { - if (((bitField0_ & 0x00100000) == 0x00100000) && timestamp_ != null + if (((bitField0_ & 0x00100000) != 0) && timestamp_ != null && timestamp_ != com.google.protobuf.Timestamp.getDefaultInstance()) { timestamp_ = com.google.protobuf.Timestamp.newBuilder(timestamp_).mergeFrom(value).buildPartial(); } else { @@ -3373,10 +3885,12 @@ private com.google.protobuf.SingleFieldBuilderV3 PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public Foo parsePartialFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -3412,6 +3927,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.Foo getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -3421,6 +3937,20 @@ public org.apache.avro.protobuf.noopt.Test.Foo getDefaultInstanceForType() { public interface MOrBuilder extends // @@protoc_insertion_point(interface_extends:org.apache.avro.protobuf.noopt.M) com.google.protobuf.MessageOrBuilder { + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @return Whether the enumN field is set. + */ + boolean hasEnumN(); + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @return The enumN. + */ + org.apache.avro.protobuf.noopt.Test.M.N getEnumN(); } /** @@ -3441,6 +3971,13 @@ private M(com.google.protobuf.GeneratedMessageV3.Builder builder) { } private M() { + enumN_ = 1; + } + + @java.lang.Override + @SuppressWarnings({ "unused" }) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new M(); } @java.lang.Override @@ -3454,6 +3991,7 @@ private M(com.google.protobuf.CodedInputStream input, com.google.protobuf.Extens if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } + int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; @@ -3463,6 +4001,18 @@ private M(com.google.protobuf.CodedInputStream input, com.google.protobuf.Extens case 0: done = true; break; + case 8: { + int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") + org.apache.avro.protobuf.noopt.Test.M.N value = org.apache.avro.protobuf.noopt.Test.M.N.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + enumN_ = rawValue; + } + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; @@ -3485,6 +4035,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_M_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_M_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.noopt.Test.M.class, @@ -3510,6 +4061,8 @@ public final int getNumber() { } /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -3517,6 +4070,10 @@ public static N valueOf(int value) { return forNumber(value); } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ public static N forNumber(int value) { switch (value) { case 1: @@ -3566,8 +4123,35 @@ private N(int value) { // @@protoc_insertion_point(enum_scope:org.apache.avro.protobuf.noopt.M.N) } + private int bitField0_; + public static final int ENUMN_FIELD_NUMBER = 1; + private int enumN_; + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @return Whether the enumN field is set. + */ + @java.lang.Override + public boolean hasEnumN() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @return The enumN. + */ + @java.lang.Override + public org.apache.avro.protobuf.noopt.Test.M.N getEnumN() { + @SuppressWarnings("deprecation") + org.apache.avro.protobuf.noopt.Test.M.N result = org.apache.avro.protobuf.noopt.Test.M.N.valueOf(enumN_); + return result == null ? org.apache.avro.protobuf.noopt.Test.M.N.A : result; + } + private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) @@ -3579,16 +4163,24 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeEnum(1, enumN_); + } unknownFields.writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, enumN_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -3604,9 +4196,15 @@ public boolean equals(final java.lang.Object obj) { } org.apache.avro.protobuf.noopt.Test.M other = (org.apache.avro.protobuf.noopt.Test.M) obj; - boolean result = true; - result = result && unknownFields.equals(other.unknownFields); - return result; + if (hasEnumN() != other.hasEnumN()) + return false; + if (hasEnumN()) { + if (enumN_ != other.enumN_) + return false; + } + if (!unknownFields.equals(other.unknownFields)) + return false; + return true; } @java.lang.Override @@ -3616,6 +4214,10 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); + if (hasEnumN()) { + hash = (37 * hash) + ENUMN_FIELD_NUMBER; + hash = (53 * hash) + enumN_; + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -3684,6 +4286,7 @@ public static org.apache.avro.protobuf.noopt.Test.M parseFrom(com.google.protobu return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } @@ -3696,6 +4299,7 @@ public static Builder newBuilder(org.apache.avro.protobuf.noopt.Test.M prototype return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @@ -3720,6 +4324,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_M_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_M_fieldAccessorTable .ensureFieldAccessorsInitialized(org.apache.avro.protobuf.noopt.Test.M.class, @@ -3741,19 +4346,25 @@ private void maybeForceBuilderInitialization() { } } + @java.lang.Override public Builder clear() { super.clear(); + enumN_ = 1; + bitField0_ = (bitField0_ & ~0x00000001); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.apache.avro.protobuf.noopt.Test.internal_static_org_apache_avro_protobuf_noopt_M_descriptor; } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.M getDefaultInstanceForType() { return org.apache.avro.protobuf.noopt.Test.M.getDefaultInstance(); } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.M build() { org.apache.avro.protobuf.noopt.Test.M result = buildPartial(); if (!result.isInitialized()) { @@ -3762,37 +4373,52 @@ public org.apache.avro.protobuf.noopt.Test.M build() { return result; } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.M buildPartial() { org.apache.avro.protobuf.noopt.Test.M result = new org.apache.avro.protobuf.noopt.Test.M(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + to_bitField0_ |= 0x00000001; + } + result.enumN_ = enumN_; + result.bitField0_ = to_bitField0_; onBuilt(); return result; } + @java.lang.Override public Builder clone() { - return (Builder) super.clone(); + return super.clone(); } + @java.lang.Override public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.setField(field, value); + return super.setField(field, value); } + @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); + return super.clearField(field); } + @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); + return super.clearOneof(oneof); } + @java.lang.Override public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); + return super.setRepeatedField(field, index, value); } + @java.lang.Override public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); + return super.addRepeatedField(field, value); } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.apache.avro.protobuf.noopt.Test.M) { return mergeFrom((org.apache.avro.protobuf.noopt.Test.M) other); @@ -3805,15 +4431,20 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(org.apache.avro.protobuf.noopt.Test.M other) { if (other == org.apache.avro.protobuf.noopt.Test.M.getDefaultInstance()) return this; + if (other.hasEnumN()) { + setEnumN(other.getEnumN()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.apache.avro.protobuf.noopt.Test.M parsedMessage = null; @@ -3830,10 +4461,66 @@ public Builder mergeFrom(com.google.protobuf.CodedInputStream input, return this; } + private int bitField0_; + + private int enumN_ = 1; + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @return Whether the enumN field is set. + */ + @java.lang.Override + public boolean hasEnumN() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @return The enumN. + */ + @java.lang.Override + public org.apache.avro.protobuf.noopt.Test.M.N getEnumN() { + @SuppressWarnings("deprecation") + org.apache.avro.protobuf.noopt.Test.M.N result = org.apache.avro.protobuf.noopt.Test.M.N.valueOf(enumN_); + return result == null ? org.apache.avro.protobuf.noopt.Test.M.N.A : result; + } + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @param value The enumN to set. + * @return This builder for chaining. + */ + public Builder setEnumN(org.apache.avro.protobuf.noopt.Test.M.N value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + enumN_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * optional .org.apache.avro.protobuf.noopt.M.N enumN = 1; + * + * @return This builder for chaining. + */ + public Builder clearEnumN() { + bitField0_ = (bitField0_ & ~0x00000001); + enumN_ = 1; + onChanged(); + return this; + } + + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } + @java.lang.Override public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } @@ -3853,6 +4540,7 @@ public static org.apache.avro.protobuf.noopt.Test.M getDefaultInstance() { @java.lang.Deprecated public static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public M parsePartialFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -3869,6 +4557,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.apache.avro.protobuf.noopt.Test.M getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -3900,18 +4589,11 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "ache.avro.protobuf.noopt.Foo\022/\n\004syms\030\023 \003" + "(\0162!.org.apache.avro.protobuf.noopt.A\0220\n" + "\003foo\030\022 \001(\0132#.org.apache.avro.protobuf.no" + "opt.Foo\022-\n\ttimestamp\030\025 \001(\0132\032.google.prot" - + "obuf.Timestamp\"\017\n\001M\"\n\n\001N\022\005\n\001A\020\001*\030\n\001A\022\005\n\001" - + "X\020\001\022\005\n\001Y\020\002\022\005\n\001Z\020\003" }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.TimestampProto.getDescriptor(), }, - assigner); + + "obuf.Timestamp\"C\n\001M\0222\n\005enumN\030\001 \001(\0162#.org" + + ".apache.avro.protobuf.noopt.M.N\"\n\n\001N\022\005\n\001" + + "A\020\001*\030\n\001A\022\005\n\001X\020\001\022\005\n\001Y\020\002\022\005\n\001Z\020\003" }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.TimestampProto.getDescriptor(), }); internal_static_org_apache_avro_protobuf_noopt_Foo_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_org_apache_avro_protobuf_noopt_Foo_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_org_apache_avro_protobuf_noopt_Foo_descriptor, @@ -3920,7 +4602,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( "Syms", "Foo", "Timestamp", }); internal_static_org_apache_avro_protobuf_noopt_M_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_org_apache_avro_protobuf_noopt_M_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_org_apache_avro_protobuf_noopt_M_descriptor, new java.lang.String[] {}); + internal_static_org_apache_avro_protobuf_noopt_M_descriptor, new java.lang.String[] { "EnumN", }); com.google.protobuf.TimestampProto.getDescriptor(); } diff --git a/lang/java/protobuf/src/test/protobuf/test.proto b/lang/java/protobuf/src/test/protobuf/test.proto index 12fa5635a79..880b6d76500 100644 --- a/lang/java/protobuf/src/test/protobuf/test.proto +++ b/lang/java/protobuf/src/test/protobuf/test.proto @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +syntax = "proto2"; package org.apache.avro.protobuf.noopt; import "google/protobuf/timestamp.proto"; @@ -63,4 +63,5 @@ message M { enum N { A = 1; } + optional N enumN = 1; } diff --git a/lang/java/protobuf/src/test/protobuf/test_multiple_files.proto b/lang/java/protobuf/src/test/protobuf/test_multiple_files.proto index 082f567eebd..cc380834e9f 100644 --- a/lang/java/protobuf/src/test/protobuf/test_multiple_files.proto +++ b/lang/java/protobuf/src/test/protobuf/test_multiple_files.proto @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +syntax = "proto2"; package org.apache.avro.protobuf.multiplefiles; import "google/protobuf/timestamp.proto";