From 3581d85ced36aa468fbf90f22ed021ce23f3c24d Mon Sep 17 00:00:00 2001 From: Jason Lunn Date: Sun, 3 Oct 2021 18:25:43 -0400 Subject: [PATCH] Update JRuby to leverage pure-Ruby DSL. JRuby unit and conformance test fixes. --- Makefile.am | 5 - conformance/failure_list_jruby.txt | 771 +----------------- ruby/Rakefile | 29 +- ruby/lib/google/protobuf.rb | 3 +- ruby/pom.xml | 2 +- .../google/protobuf/jruby/RubyBuilder.java | 147 ---- .../protobuf/jruby/RubyDescriptorPool.java | 21 +- .../jruby/RubyEnumBuilderContext.java | 91 --- .../protobuf/jruby/RubyEnumDescriptor.java | 8 + .../protobuf/jruby/RubyFieldDescriptor.java | 5 +- .../jruby/RubyFileBuilderContext.java | 348 -------- .../com/google/protobuf/jruby/RubyMap.java | 24 +- .../google/protobuf/jruby/RubyMessage.java | 183 +++-- .../jruby/RubyMessageBuilderContext.java | 255 ------ .../jruby/RubyOneofBuilderContext.java | 103 --- .../java/com/google/protobuf/jruby/Utils.java | 78 +- .../main/java/google/ProtobufJavaService.java | 5 - ruby/tests/basic.rb | 3 +- ruby/tests/common_tests.rb | 9 +- ruby/tests/stress.rb | 2 +- ruby/travis-test.sh | 4 +- 21 files changed, 264 insertions(+), 1832 deletions(-) delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java diff --git a/Makefile.am b/Makefile.am index e6df531d4e..6fb1c84fc5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1150,19 +1150,14 @@ ruby_EXTRA_DIST= \ ruby/lib/google/protobuf/well_known_types.rb \ ruby/lib/google/protobuf.rb \ ruby/pom.xml \ - ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java \ diff --git a/conformance/failure_list_jruby.txt b/conformance/failure_list_jruby.txt index ceaaf92a5f..516192ec00 100644 --- a/conformance/failure_list_jruby.txt +++ b/conformance/failure_list_jruby.txt @@ -2,6 +2,34 @@ Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput Recommended.FieldMaskPathsDontRoundTrip.JsonOutput Recommended.FieldMaskTooManyUnderscore.JsonOutput Recommended.Proto2.JsonInput.FieldNameExtension.Validator +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.JsonInput.BoolFieldAllCapitalFalse Recommended.Proto3.JsonInput.BoolFieldAllCapitalTrue Recommended.Proto3.JsonInput.BoolFieldCamelCaseFalse @@ -29,782 +57,39 @@ Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate Recommended.Proto3.JsonInput.Uint32MapFieldKeyNotQuoted Recommended.Proto3.JsonInput.Uint64MapFieldKeyNotQuoted -Recommended.Proto3.ProtobufInput.OneofZeroBool.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroBool.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroBytes.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroDouble.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroDouble.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroEnum.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroEnum.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroFloat.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroFloat.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroMessage.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroMessage.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroMessageSetTwice.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroMessageSetTwice.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroString.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroString.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroUint32.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroUint32.ProtobufOutput -Recommended.Proto3.ProtobufInput.OneofZeroUint64.JsonOutput -Recommended.Proto3.ProtobufInput.OneofZeroUint64.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.DefaultValue.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.DefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.NonDefaultValue.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[4].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[5].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[6].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BYTES[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.DOUBLE[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.DOUBLE[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[0].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[5].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED32[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[4].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[4].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[5].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[6].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[7].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[8].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[9].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.MESSAGE[0].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.MESSAGE[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED32[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED32[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[4].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[4].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[5].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[6].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[2].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[4].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[5].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[6].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[7].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[8].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[9].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[1].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput -Required.DurationProtoInputTooLarge.JsonOutput -Required.DurationProtoInputTooSmall.JsonOutput -Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator -Required.Proto3.JsonInput.Any.JsonOutput -Required.Proto3.JsonInput.Any.ProtobufOutput -Required.Proto3.JsonInput.AnyNested.JsonOutput -Required.Proto3.JsonInput.AnyNested.ProtobufOutput -Required.Proto3.JsonInput.AnyUnorderedTypeTag.JsonOutput -Required.Proto3.JsonInput.AnyUnorderedTypeTag.ProtobufOutput -Required.Proto3.JsonInput.AnyWithDuration.JsonOutput -Required.Proto3.JsonInput.AnyWithDuration.ProtobufOutput -Required.Proto3.JsonInput.AnyWithFieldMask.JsonOutput -Required.Proto3.JsonInput.AnyWithFieldMask.ProtobufOutput -Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.JsonOutput -Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput -Required.Proto3.JsonInput.AnyWithStruct.JsonOutput -Required.Proto3.JsonInput.AnyWithStruct.ProtobufOutput -Required.Proto3.JsonInput.AnyWithTimestamp.JsonOutput -Required.Proto3.JsonInput.AnyWithTimestamp.ProtobufOutput -Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput -Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput -Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput -Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput Required.Proto3.JsonInput.EnumFieldNotQuoted -Required.Proto3.JsonInput.IgnoreUnknownJsonFalse.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonNull.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonNumber.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonObject.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonString.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonTrue.ProtobufOutput Required.Proto3.JsonInput.Int32FieldLeadingZero Required.Proto3.JsonInput.Int32FieldNegativeWithLeadingZero Required.Proto3.JsonInput.Int32FieldPlusSign Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt Required.Proto3.JsonInput.StringFieldNotAString -Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput -Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput -Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput -Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput -Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.BOOL -Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT32 -Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT64 -Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT32 -Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT64 -Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT32 -Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT64 -Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BOOL.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BOOL.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BYTES.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BYTES.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.ENUM.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.ENUM.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FLOAT.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FLOAT.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT32.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT64.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT64.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED32.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED32.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED64.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED64.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT32.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT32.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT64.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT64.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.STRING.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.STRING.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT32.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput -Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Default.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Default.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKey.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKey.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKeyInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateValueInMapEntry.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.MissingDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.NonDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.NonDefault.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Unordered.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Unordered.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.Merge.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.Merge.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.STRING.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.DefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.DefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForDifferentField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForSameField.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForSameField.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.NonDefaultValue.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.NonDefaultValue.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.MESSAGE.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.MESSAGE.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[4].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[4].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[5].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[5].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[6].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[6].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BYTES[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.BYTES[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[0].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[0].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[4].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[4].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[5].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[5].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FIXED32[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FIXED32[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FIXED64[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[4].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[4].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[4].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[4].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[5].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[5].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[6].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[6].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[7].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[7].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[8].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[8].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[9].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT32[9].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT64[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT64[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT64[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT64[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.INT64[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[0].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[0].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[4].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[4].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[4].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[4].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[5].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[5].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[6].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.STRING[6].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[2].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[3].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[3].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[4].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[4].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[5].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[5].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[6].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[6].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[7].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[7].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[8].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[8].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[9].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[9].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[1].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[1].ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[2].JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput -Required.TimestampProtoInputTooLarge.JsonOutput -Required.TimestampProtoInputTooSmall.JsonOutput diff --git a/ruby/Rakefile b/ruby/Rakefile index c7187a6a89..8aae2ee872 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -67,16 +67,18 @@ unless ENV['IN_DOCKER'] == 'true' end if RUBY_PLATFORM == "java" - if `which mvn` == '' - raise ArgumentError, "maven needs to be installed" - end - task :clean do + task :clean => :require_mvn do system("mvn --batch-mode clean") end - task :compile do + task :compile => :require_mvn do system("mvn --batch-mode package") end + + task :require_mvn do + raise ArgumentError, "maven needs to be installed" if `which mvn` == '' + end + else Rake::ExtensionTask.new("protobuf_c", spec) do |ext| unless RUBY_PLATFORM =~ /darwin/ @@ -95,7 +97,22 @@ else ] end + task 'gem:java' do + sh "rm Gemfile.lock" + require 'rake_compiler_dock' + # Specify the repo root as the working and mount directory to provide access + # to the java directory + repo_root = File.realdirpath File.join(Dir.pwd, '..') + RakeCompilerDock.sh <<-"EOT", platform: 'jruby', rubyvm: :jruby, mountdir: repo_root, workdir: repo_root + sudo apt-get install maven -y && \ + cd java && mvn install -Dmaven.test.skip=true && cd ../ruby && \ + bundle && \ + IN_DOCKER=true rake compile gem + EOT + end + task 'gem:windows' do + sh "rm Gemfile.lock" require 'rake_compiler_dock' ['x86-mingw32', 'x64-mingw32', 'x86_64-linux', 'x86-linux'].each do |plat| RakeCompilerDock.sh <<-"EOT", platform: plat @@ -111,7 +128,7 @@ else system "rake cross native gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.1:2.4.0:2.3.0" end else - task 'gem:native' => [:genproto, 'gem:windows'] + task 'gem:native' => [:genproto, 'gem:windows', 'gem:java'] end end diff --git a/ruby/lib/google/protobuf.rb b/ruby/lib/google/protobuf.rb index 936876803f..a68154deaa 100644 --- a/ruby/lib/google/protobuf.rb +++ b/ruby/lib/google/protobuf.rb @@ -51,9 +51,10 @@ else require 'google/protobuf_c' end - require 'google/protobuf/descriptor_dsl' end +require 'google/protobuf/descriptor_dsl' + require 'google/protobuf/repeated_field' module Google diff --git a/ruby/pom.xml b/ruby/pom.xml index 6c96bf42a3..00498585c4 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -88,7 +88,7 @@ com.google.protobuf protobuf-java-util - 3.13.0 + 3.18.0 diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java deleted file mode 100644 index b19ea6473e..0000000000 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Protocol Buffers - Google's data interchange format - * Copyright 2014 Google Inc. All rights reserved. - * https://developers.google.com/protocol-buffers/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.google.protobuf.jruby; - -import org.jruby.*; -import org.jruby.anno.JRubyClass; -import org.jruby.anno.JRubyMethod; -import org.jruby.runtime.*; -import org.jruby.runtime.builtin.IRubyObject; - -@JRubyClass(name = "Builder") -public class RubyBuilder extends RubyObject { - public static void createRubyBuilder(Ruby runtime) { - RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal"); - RubyClass cBuilder = internal.defineClassUnder("Builder", runtime.getObject(), new ObjectAllocator() { - @Override - public IRubyObject allocate(Ruby runtime, RubyClass klazz) { - return new RubyBuilder(runtime, klazz); - } - }); - cBuilder.defineAnnotatedMethods(RubyBuilder.class); - } - - public RubyBuilder(Ruby runtime, RubyClass metaClass) { - super(runtime, metaClass); - this.cFileBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::FileBuilderContext"); - } - - /* - * call-seq: - * Builder.new => builder - * - * Creates a new Builder. A Builder can accumulate a set of new message and enum - * descriptors and atomically register them into a pool in a way that allows for - * (co)recursive type references. - */ - @JRubyMethod - public IRubyObject initialize(ThreadContext context, IRubyObject descriptorPool) { - this.descriptorPool = (RubyDescriptorPool) descriptorPool; - return this; - } - - /* - * call-seq: - * Builder.add_message(name, &block) - * - * Old and deprecated way to create a new descriptor. - * See FileBuilderContext.add_message for the recommended way. - * - * Exists for backwards compatibility to allow building descriptor pool for - * files generated by protoc which don't add messages within "add_file" block. - * Descriptors created this way get assigned to a default empty FileDescriptor. - */ - @JRubyMethod(name = "add_message") - public IRubyObject addMessage(ThreadContext context, IRubyObject name, Block block) { - ensureDefaultFileBuilder(context); - defaultFileBuilder.addMessage(context, name, block); - return context.nil; - } - - /* - * call-seq: - * Builder.add_enum(name, &block) - * - * Old and deprecated way to create a new enum descriptor. - * See FileBuilderContext.add_enum for the recommended way. - * - * Exists for backwards compatibility to allow building descriptor pool for - * files generated by protoc which don't add enums within "add_file" block. - * Enum descriptors created this way get assigned to a default empty - * FileDescriptor. - */ - @JRubyMethod(name = "add_enum") - public IRubyObject addEnum(ThreadContext context, IRubyObject name, Block block) { - ensureDefaultFileBuilder(context); - defaultFileBuilder.addEnum(context, name, block); - return context.nil; - } - - /* - * call-seq: - * Builder.add_file(name, options = nil, &block) - * - * Creates a new, file descriptor with the given name and options and invokes - * the block in the context of a FileBuilderContext on that descriptor. The - * block can then call FileBuilderContext#add_message or - * FileBuilderContext#add_enum to define new messages or enums, respectively. - * - * This is the recommended, idiomatic way to build file descriptors. - */ - @JRubyMethod(name = "add_file") - public IRubyObject addFile(ThreadContext context, IRubyObject name, IRubyObject options, Block block) { - RubyFileBuilderContext ctx = (RubyFileBuilderContext) cFileBuilderContext.newInstance(context, descriptorPool, name, options, Block.NULL_BLOCK); - ctx.instance_eval(context, block); - ctx.build(context); - return context.nil; - } - - /* - * Used to trigger the build when using the deprecated syntax - */ - protected void build(ThreadContext context) { - if (defaultFileBuilder != null) { - defaultFileBuilder.build(context); - } - } - - private void ensureDefaultFileBuilder(ThreadContext context) { - if (defaultFileBuilder == null) { - this.defaultFileBuilder = (RubyFileBuilderContext) cFileBuilderContext.newInstance(context, descriptorPool, context.runtime.newString("ruby_default_file.proto"), Block.NULL_BLOCK); - } - } - - private RubyClass cFileBuilderContext; - private RubyDescriptorPool descriptorPool; - private RubyFileBuilderContext defaultFileBuilder; -} diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java index 99a7f02d1d..6cdb341427 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java @@ -37,9 +37,11 @@ import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.DescriptorValidationException; import com.google.protobuf.Descriptors.EnumDescriptor; import com.google.protobuf.Descriptors.FileDescriptor; +import com.google.protobuf.InvalidProtocolBufferException; import org.jruby.*; import org.jruby.anno.JRubyClass; import org.jruby.anno.JRubyMethod; +import org.jruby.exceptions.RaiseException; import org.jruby.runtime.*; import org.jruby.runtime.builtin.IRubyObject; @@ -61,7 +63,6 @@ public class RubyDescriptorPool extends RubyObject { cDescriptorPool.defineAnnotatedMethods(RubyDescriptorPool.class); descriptorPool = (RubyDescriptorPool) cDescriptorPool.newInstance(runtime.getCurrentContext(), Block.NULL_BLOCK); - cBuilder = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::Builder"); cDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Descriptor"); cEnumDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::EnumDescriptor"); } @@ -74,9 +75,10 @@ public class RubyDescriptorPool extends RubyObject { @JRubyMethod public IRubyObject build(ThreadContext context, Block block) { - RubyBuilder ctx = (RubyBuilder) cBuilder.newInstance(context, this, Block.NULL_BLOCK); + RubyClass cBuilder = (RubyClass) context.runtime.getClassFromPath("Google::Protobuf::Internal::Builder"); + RubyBasicObject ctx = (RubyBasicObject) cBuilder.newInstance(context, this, Block.NULL_BLOCK); ctx.instance_eval(context, block); - ctx.build(context); // Needs to be called to support the deprecated syntax + ctx.callMethod(context, "build"); // Needs to be called to support the deprecated syntax return context.nil; } @@ -109,6 +111,18 @@ public class RubyDescriptorPool extends RubyObject { return descriptorPool; } + @JRubyMethod(required = 1) + public IRubyObject add_serialized_file (ThreadContext context, IRubyObject data ) { + byte[] bin = data.convertToString().getBytes(); + try { + FileDescriptorProto.Builder builder = FileDescriptorProto.newBuilder().mergeFrom(bin); + registerFileDescriptor(context, builder); + } catch (InvalidProtocolBufferException e) { + throw RaiseException.from(context.runtime, (RubyClass) context.runtime.getClassFromPath("Google::Protobuf::ParseError"), e.getMessage()); + } + return context.nil; + } + protected void registerFileDescriptor(ThreadContext context, FileDescriptorProto.Builder builder) { final FileDescriptor fd; try { @@ -157,7 +171,6 @@ public class RubyDescriptorPool extends RubyObject { return fileDescriptors.toArray(new FileDescriptor[fileDescriptors.size()]); } - private static RubyClass cBuilder; private static RubyClass cDescriptor; private static RubyClass cEnumDescriptor; private static RubyDescriptorPool descriptorPool; diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java deleted file mode 100644 index 38d31ad7fe..0000000000 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Protocol Buffers - Google's data interchange format - * Copyright 2014 Google Inc. All rights reserved. - * https://developers.google.com/protocol-buffers/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.google.protobuf.jruby; - -import com.google.protobuf.DescriptorProtos.EnumDescriptorProto; -import org.jruby.Ruby; -import org.jruby.RubyClass; -import org.jruby.RubyModule; -import org.jruby.RubyNumeric; -import org.jruby.RubyObject; -import org.jruby.anno.JRubyClass; -import org.jruby.anno.JRubyMethod; -import org.jruby.runtime.ObjectAllocator; -import org.jruby.runtime.ThreadContext; -import org.jruby.runtime.builtin.IRubyObject; - -@JRubyClass(name = "EnumBuilderContext") -public class RubyEnumBuilderContext extends RubyObject { - public static void createRubyEnumBuilderContext(Ruby runtime) { - RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal"); - RubyClass cEnumBuilderContext = internal.defineClassUnder("EnumBuilderContext", runtime.getObject(), new ObjectAllocator() { - @Override - public IRubyObject allocate(Ruby runtime, RubyClass klazz) { - return new RubyEnumBuilderContext(runtime, klazz); - } - }); - cEnumBuilderContext.defineAnnotatedMethods(RubyEnumBuilderContext.class); - } - - public RubyEnumBuilderContext(Ruby ruby, RubyClass klazz) { - super(ruby, klazz); - } - - @JRubyMethod - public IRubyObject initialize(ThreadContext context, IRubyObject fileBuilderContext, IRubyObject name) { - this.fileBuilderContext = (RubyFileBuilderContext) fileBuilderContext; - this.builder = this.fileBuilderContext.getNewEnumBuilder(); - this.builder.setName(name.asJavaString()); - this.builder.getOptionsBuilder().setAllowAlias(true); - - return this; - } - - /* - * call-seq: - * EnumBuilder.add_value(name, number) - * - * Adds the given name => number mapping to the enum type. Name must be a Ruby - * symbol. - */ - @JRubyMethod - public IRubyObject value(ThreadContext context, IRubyObject name, IRubyObject number) { - this.builder.addValueBuilder() - .setName(name.asJavaString()) - .setNumber(RubyNumeric.num2int(number)); - return context.nil; - } - - private EnumDescriptorProto.Builder builder; - private RubyFileBuilderContext fileBuilderContext; -} diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java index e9c1f10abe..26f00db666 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java @@ -35,6 +35,7 @@ package com.google.protobuf.jruby; import com.google.protobuf.DescriptorProtos.EnumDescriptorProto; import com.google.protobuf.Descriptors.EnumDescriptor; import com.google.protobuf.Descriptors.EnumValueDescriptor; +import com.google.protobuf.Descriptors.FileDescriptor; import org.jruby.Ruby; import org.jruby.RubyClass; import org.jruby.RubyModule; @@ -151,6 +152,7 @@ public class RubyEnumDescriptor extends RubyObject { Ruby runtime = context.runtime; RubyModule enumModule = RubyModule.newModule(runtime); + boolean defaultValueRequiredButNotFound = descriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO3; for (EnumValueDescriptor value : descriptor.getValues()) { String name = value.getName(); // Make sure its a valid constant name before trying to create it @@ -159,8 +161,14 @@ public class RubyEnumDescriptor extends RubyObject { } else { runtime.getWarnings().warn("Enum value " + name + " does not start with an uppercase letter as is required for Ruby constants."); } + if (value.getNumber() == 0) { + defaultValueRequiredButNotFound = false; + } } + if (defaultValueRequiredButNotFound) { + throw Utils.createTypeError(context, "Enum definition " + name + " does not contain a value for '0'"); + } enumModule.instance_variable_set(runtime.newString(Utils.DESCRIPTOR_INSTANCE_VAR), this); enumModule.defineAnnotatedMethods(RubyEnum.class); return enumModule; diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java index 8ac5e4c4d7..e9594d831d 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java @@ -32,8 +32,8 @@ package com.google.protobuf.jruby; -import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.FieldDescriptor; +import com.google.protobuf.Descriptors.FileDescriptor; import org.jruby.*; import org.jruby.anno.JRubyClass; import org.jruby.anno.JRubyMethod; @@ -228,6 +228,9 @@ public class RubyFieldDescriptor extends RubyObject { } protected void setDescriptor(ThreadContext context, FieldDescriptor descriptor, RubyDescriptorPool pool) { + if (descriptor.isRequired() && descriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO3) { + throw Utils.createTypeError(context, descriptor.getName() + " is labeled required but required fields are unsupported in proto3"); + } this.descriptor = descriptor; this.name = context.runtime.newString(descriptor.getName()); this.pool = pool; diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java deleted file mode 100644 index 00ce3f2158..0000000000 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Protocol Buffers - Google's data interchange format - * Copyright 2014 Google Inc. All rights reserved. - * https://developers.google.com/protocol-buffers/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.google.protobuf.jruby; - -import com.google.protobuf.DescriptorProtos.DescriptorProto; -import com.google.protobuf.DescriptorProtos.EnumDescriptorProto; -import com.google.protobuf.DescriptorProtos.EnumValueDescriptorProtoOrBuilder; -import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; -import com.google.protobuf.DescriptorProtos.FileDescriptorProto; -import com.google.protobuf.Descriptors.FieldDescriptor; -import org.jruby.Ruby; -import org.jruby.RubyClass; -import org.jruby.RubyHash; -import org.jruby.RubyModule; -import org.jruby.RubyObject; -import org.jruby.anno.JRubyClass; -import org.jruby.anno.JRubyMethod; -import org.jruby.runtime.Block; -import org.jruby.runtime.ObjectAllocator; -import org.jruby.runtime.ThreadContext; -import org.jruby.runtime.builtin.IRubyObject; - -import java.util.HashMap; -import java.util.List; -import java.util.TreeMap; - -@JRubyClass(name = "FileBuilderContext") -public class RubyFileBuilderContext extends RubyObject { - public static void createRubyFileBuilderContext(Ruby runtime) { - RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal"); - RubyClass cFileBuilderContext = internal.defineClassUnder("FileBuilderContext", runtime.getObject(), new ObjectAllocator() { - @Override - public IRubyObject allocate(Ruby runtime, RubyClass klazz) { - return new RubyFileBuilderContext(runtime, klazz); - } - }); - cFileBuilderContext.defineAnnotatedMethods(RubyFileBuilderContext.class); - - cDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Descriptor"); - cEnumBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::EnumBuilderContext"); - cEnumDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::EnumDescriptor"); - cMessageBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::MessageBuilderContext"); - } - - public RubyFileBuilderContext(Ruby runtime, RubyClass klazz) { - super(runtime, klazz); - } - - /* - * call-seq: - * FileBuilderContext.new(descriptor_pool, name, options = nil) => context - * - * Create a new file builder context for the given file descriptor and - * builder context. This class is intended to serve as a DSL context to be used - * with #instance_eval. - */ - @JRubyMethod(required = 2, optional = 1) - public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { - this.descriptorPool = (RubyDescriptorPool) args[0]; - this.builder = FileDescriptorProto.newBuilder(); - this.builder.setName(args[1].asJavaString()); - this.builder.setSyntax("proto3"); - - if (args.length > 2) { - RubyHash options = (RubyHash) args[2]; - IRubyObject syntax = options.fastARef(context.runtime.newSymbol("syntax")); - - if (syntax != null) { - String syntaxStr = syntax.asJavaString(); - this.builder.setSyntax(syntaxStr); - this.proto3 = syntaxStr.equals("proto3"); - } - } - - return this; - } - - /* - * call-seq: - * FileBuilderContext.add_enum(name, &block) - * - * Creates a new, empty enum descriptor with the given name, and invokes the - * block in the context of an EnumBuilderContext on that descriptor. The block - * can then call EnumBuilderContext#add_value to define the enum values. - * - * This is the recommended, idiomatic way to build enum definitions. - */ - @JRubyMethod(name = "add_enum") - public IRubyObject addEnum(ThreadContext context, IRubyObject name, Block block) { - RubyObject ctx = (RubyObject) cEnumBuilderContext.newInstance(context, this, name, Block.NULL_BLOCK); - ctx.instance_eval(context, block); - - return context.nil; - } - - /* - * call-seq: - * FileBuilderContext.add_message(name, &block) - * - * Creates a new, empty descriptor with the given name, and invokes the block in - * the context of a MessageBuilderContext on that descriptor. The block can then - * call, e.g., MessageBuilderContext#optional and MessageBuilderContext#repeated - * methods to define the message fields. - * - * This is the recommended, idiomatic way to build message definitions. - */ - @JRubyMethod(name = "add_message") - public IRubyObject addMessage(ThreadContext context, IRubyObject name, Block block) { - RubyObject ctx = (RubyObject) cMessageBuilderContext.newInstance(context, this, name, Block.NULL_BLOCK); - ctx.instance_eval(context, block); - - return context.nil; - } - - protected void build(ThreadContext context) { - Ruby runtime = context.runtime; - List messageBuilderList = builder.getMessageTypeBuilderList(); - List enumBuilderList = builder.getEnumTypeBuilderList(); - - // Get the package name from defined names - String packageName = getPackageName(messageBuilderList, enumBuilderList); - - if (!packageName.isEmpty()) { - builder.setPackage(packageName); - } - - // Make an index of the message builders so we can easily nest them - TreeMap messageBuilderMap = new TreeMap(); - for (DescriptorProto.Builder messageBuilder : messageBuilderList) { - messageBuilderMap.put(messageBuilder.getName(), messageBuilder); - } - - // Make an index of the enum builders so we can easily nest them - HashMap enumBuilderMap = new HashMap(); - for (EnumDescriptorProto.Builder enumBuilder : enumBuilderList) { - enumBuilderMap.put("." + enumBuilder.getName(), enumBuilder); - } - - // Rename and properly nest messages and create associated ruby objects - int packageNameLength = packageName.length(); - int currentMessageIndex = 0; - int currentEnumIndex = 0; - - // Need to get a static list because we are potentially deleting some of them from the collection - DescriptorProto.Builder[] messageBuilders = new DescriptorProto.Builder[messageBuilderList.size()]; - messageBuilderList.toArray(messageBuilders); - EnumDescriptorProto.Builder[] enumBuilders = new EnumDescriptorProto.Builder[enumBuilderList.size()]; - enumBuilderList.toArray(enumBuilders); - - for (EnumDescriptorProto.Builder enumBuilder : enumBuilders) { - String name = enumBuilder.getName(); - int lastDot = name.lastIndexOf('.'); - - if (lastDot > packageNameLength) { - String parentName = name.substring(0, lastDot); - String shortName = name.substring(lastDot + 1); - - enumBuilder.setName(shortName); - messageBuilderMap.get(parentName).addEnumType(enumBuilder); - - builder.removeEnumType(currentEnumIndex); - - } else { - if (packageNameLength > 0) { - // Remove the package name - String shortName = name.substring(packageNameLength + 1); - enumBuilder.setName(shortName); - } - - currentEnumIndex++; - } - - // Ensure we have a default value if using proto3 syntax - if (proto3) { - boolean foundDefault = false; - for (EnumValueDescriptorProtoOrBuilder enumValue : enumBuilder.getValueOrBuilderList()) { - if (enumValue.getNumber() == 0) { - foundDefault = true; - break; - } - } - - if (!foundDefault) { - throw Utils.createTypeError(context, "Enum definition " + enumBuilder.getName() + " does not contain a value for '0'"); - } - } - } - - // Wipe out top level message builders so we can insert only the ones that should be there - builder.clearMessageType(); - - /* - * This block is done in this order because calling - * `addNestedType` and `addMessageType` makes a copy of the builder - * so the objects that our maps point to are no longer the objects - * that are being used to build the descriptions. - */ - for (HashMap.Entry entry : messageBuilderMap.descendingMap().entrySet()) { - DescriptorProto.Builder messageBuilder = entry.getValue(); - - // Rewrite any enum defaults needed - for(FieldDescriptorProto.Builder field : messageBuilder.getFieldBuilderList()) { - String typeName = field.getTypeName(); - - if (typeName == null || !field.hasDefaultValue()) continue; - - EnumDescriptorProto.Builder enumBuilder = enumBuilderMap.get(typeName); - - if (enumBuilder == null) continue; - - int defaultValue = Integer.parseInt(field.getDefaultValue()); - - for (EnumValueDescriptorProtoOrBuilder enumValue : enumBuilder.getValueOrBuilderList()) { - if (enumValue.getNumber() == defaultValue) { - field.setDefaultValue(enumValue.getName()); - break; - } - } - } - - // Turn Foo.Bar.Baz into a correctly nested structure with the correct name - String name = messageBuilder.getName(); - int lastDot = name.lastIndexOf('.'); - - if (lastDot > packageNameLength) { - String parentName = name.substring(0, lastDot); - String shortName = name.substring(lastDot + 1); - messageBuilder.setName(shortName); - messageBuilderMap.get(parentName).addNestedType(messageBuilder); - - } else { - if (packageNameLength > 0) { - // Remove the package name - messageBuilder.setName(name.substring(packageNameLength + 1)); - } - - // Add back in top level message definitions - builder.addMessageType(messageBuilder); - - currentMessageIndex++; - } - } - - descriptorPool.registerFileDescriptor(context, builder); - } - - protected EnumDescriptorProto.Builder getNewEnumBuilder() { - return builder.addEnumTypeBuilder(); - } - - protected DescriptorProto.Builder getNewMessageBuilder() { - return builder.addMessageTypeBuilder(); - } - - protected boolean isProto3() { - return proto3; - } - - private String getPackageName(List messages, List enums) { - String shortest = null; - String longest = null; - - /* - * The >= in the longest string comparisons below makes it so we replace - * the name in case all the names are the same length. This makes it so - * that the shortest and longest aren't the same name to prevent - * finding a "package" that isn't correct - */ - - for (DescriptorProto.Builder message : messages) { - String name = message.getName(); - int nameLength = name.length(); - if (shortest == null) { - shortest = name; - longest = name; - } else if (nameLength < shortest.length()) { - shortest = name; - } else if (nameLength >= longest.length()) { - longest = name; - } - } - - for (EnumDescriptorProto.Builder item : enums) { - String name = item.getName(); - int nameLength = name.length(); - if (shortest == null) { - shortest = name; - longest = name; - } else if (nameLength < shortest.length()) { - shortest = name; - } else if (nameLength >= longest.length()) { - longest = name; - } - } - - if (shortest == null) { - return ""; - } - - int lastCommonDot = 0; - for (int i = 0; i < shortest.length(); i++) { - char nextChar = shortest.charAt(i); - if (nextChar != longest.charAt(i)) break; - if (nextChar == '.') lastCommonDot = i; - } - - return shortest.substring(0, lastCommonDot); - } - - private static RubyClass cDescriptor; - private static RubyClass cEnumBuilderContext; - private static RubyClass cEnumDescriptor; - private static RubyClass cMessageBuilderContext; - - private FileDescriptorProto.Builder builder; - private RubyDescriptorPool descriptorPool; - private boolean proto3 = true; -} diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java index 087f1cb4c1..8140ec5b64 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java @@ -37,7 +37,6 @@ import com.google.protobuf.DynamicMessage; import org.jruby.*; import org.jruby.anno.JRubyClass; import org.jruby.anno.JRubyMethod; -import org.jruby.internal.runtime.methods.DynamicMethod; import org.jruby.runtime.Block; import org.jruby.runtime.Helpers; import org.jruby.runtime.ObjectAllocator; @@ -80,11 +79,12 @@ public class RubyMap extends RubyObject { * on the same values as field-type symbols in message descriptors) that * indicate the type of the map key and value fields. * - * The supported key types are: :int32, :int64, :uint32, :uint64, :bool, - * :string, :bytes. + * The supported key types are: :int32, :int64, :uint32, :uint64, :fixed32, + * :fixed64, :sfixed32, :sfixed64, :sint32, :sint64, :bool, :string, :bytes. * - * The supported value types are: :int32, :int64, :uint32, :uint64, :bool, - * :string, :bytes, :enum, :message. + * The supported value types are: :int32, :int64, :uint32, :uint64, :fixed32, + * :fixed64, :sfixed32, :sfixed64, :sint32, :sint64, :bool, :string, :bytes, + * :enum, :message. * * The third argument, value_typeclass, must be present if value_type is :enum * or :message. As in RepeatedField#new, this argument must be a message class @@ -113,8 +113,14 @@ public class RubyMap extends RubyObject { break; case INT32: case INT64: + case SINT32: + case SINT64: case UINT32: case UINT64: + case FIXED32: + case FIXED64: + case SFIXED32: + case SFIXED64: case BOOL: // These are OK. break; @@ -154,7 +160,7 @@ public class RubyMap extends RubyObject { * other types for keys, so deal with them specifically first */ if (keyTypeIsString && !(key instanceof RubySymbol || key instanceof RubyString)) { - throw context.runtime.newTypeError("Expected string for map key"); + throw Utils.createTypeError(context, "Expected string for map key"); } key = Utils.checkType(context, keyType, "key", key, (RubyModule) valueTypeClass); value = Utils.checkType(context, valueType, "value", value, (RubyModule) valueTypeClass); @@ -399,7 +405,7 @@ public class RubyMap extends RubyObject { protected RubyMap mergeIntoSelf(final ThreadContext context, IRubyObject hashmap) { if (hashmap instanceof RubyHash) { - ((RubyHash) hashmap).visitAll(new RubyHash.Visitor() { + ((RubyHash) hashmap).visitAll(context, new RubyHash.Visitor() { @Override public void visit(IRubyObject key, IRubyObject val) { if (val instanceof RubyHash && !valueTypeClass.isNil()) { @@ -407,14 +413,14 @@ public class RubyMap extends RubyObject { } indexSet(context, key, val); } - }); + }, null); } else if (hashmap instanceof RubyMap) { RubyMap other = (RubyMap) hashmap; if (!typeCompatible(other)) { throw Utils.createTypeError(context, "Attempt to merge Map with mismatching types"); } } else { - throw context.runtime.newTypeError("Unknown type merging into Map"); + throw Utils.createTypeError(context, "Unknown type merging into Map"); } return this; } diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java index a905c9a260..2737182c25 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java @@ -93,16 +93,18 @@ public class RubyMessage extends RubyObject { throw runtime.newArgumentError("expected Hash arguments."); } RubyHash hash = args[0].convertToHash(); - hash.visitAll(new RubyHash.Visitor() { + hash.visitAll(context, new RubyHash.Visitor() { @Override public void visit(IRubyObject key, IRubyObject value) { - if (!(key instanceof RubySymbol) && !(key instanceof RubyString)) - throw runtime.newTypeError("Expected string or symbols as hash keys in initialization map."); + if (!(key instanceof RubySymbol) && !(key instanceof RubyString)) { + throw Utils.createTypeError(context, + "Expected string or symbols as hash keys in initialization map."); + } final FieldDescriptor fieldDescriptor = findField(context, key, ignoreUnknownFieldsOnInit); if (value == null || value.isNil()) return; - if (Utils.isMapEntry(fieldDescriptor)) { + if (fieldDescriptor.isMapField()) { if (!(value instanceof RubyHash)) throw runtime.newArgumentError("Expected Hash object as initializer value for map field '" + key.asJavaString() + "' (given " + value.getMetaClass() + ")."); @@ -130,7 +132,7 @@ public class RubyMessage extends RubyObject { } } - }); + }, null); } return this; } @@ -181,6 +183,9 @@ public class RubyMessage extends RubyObject { sb.append(cname).append(colon); for (FieldDescriptor fd : descriptor.getFields()) { + if (fd.hasPresence() && !fields.containsKey(fd)) { + continue; + } if (addComma) { sb.append(comma); } else { @@ -347,7 +352,7 @@ public class RubyMessage extends RubyObject { if (fieldDescriptor != null && (!proto3 || fieldDescriptor.getContainingOneof() == null) && // This seems like a bug but its needed to pass the tests... - fieldHasPresence(fieldDescriptor)) { + fieldDescriptor.hasPresence()) { return fields.containsKey(fieldDescriptor) ? runtime.getTrue() : runtime.getFalse(); } @@ -428,12 +433,11 @@ public class RubyMessage extends RubyObject { @JRubyMethod public IRubyObject dup(ThreadContext context) { RubyMessage dup = (RubyMessage) metaClass.newInstance(context, Block.NULL_BLOCK); - IRubyObject value; for (FieldDescriptor fieldDescriptor : this.descriptor.getFields()) { if (fieldDescriptor.isRepeated()) { dup.fields.put(fieldDescriptor, this.getRepeatedField(context, fieldDescriptor)); } else if (fields.containsKey(fieldDescriptor)) { - dup.fields.put(fieldDescriptor, fields.get(fieldDescriptor)); + dup.setFieldInternal(context, fieldDescriptor, fields.get(fieldDescriptor)); } else if (this.builder.hasField(fieldDescriptor)) { dup.fields.put(fieldDescriptor, wrapField(context, fieldDescriptor, this.builder.getField(fieldDescriptor))); } @@ -474,7 +478,7 @@ public class RubyMessage extends RubyObject { * MessageClass.decode(data) => message * * Decodes the given data (as a string containing bytes in protocol buffers wire - * format) under the interpretration given by this message class's definition + * format) under the interpretation given by this message class's definition * and returns a message object with the corresponding field values. */ @JRubyMethod(meta = true) @@ -532,11 +536,14 @@ public class RubyMessage extends RubyObject { printer = printer.preservingProtoFieldNames(); } } + printer = printer.usingTypeRegistry(JsonFormat.TypeRegistry.newBuilder().add(message.descriptor).build()); try { result = printer.print(message.build(context)); - } catch(InvalidProtocolBufferException e) { + } catch (InvalidProtocolBufferException e) { throw runtime.newRuntimeError(e.getMessage()); + } catch (IllegalArgumentException e) { + throw createParseError(context, e.getMessage()); } return runtime.newString(result); @@ -547,7 +554,7 @@ public class RubyMessage extends RubyObject { * MessageClass.decode_json(data, options = {}) => message * * Decodes the given data (as a string containing bytes in protocol buffers wire - * format) under the interpretration given by this message class's definition + * format) under the interpretation given by this message class's definition * and returns a message object with the corresponding field values. * * @param options [Hash] options for the decoder @@ -577,6 +584,7 @@ public class RubyMessage extends RubyObject { } RubyMessage ret = (RubyMessage) ((RubyClass) recv).newInstance(context, Block.NULL_BLOCK); + parser = parser.usingTypeRegistry(JsonFormat.TypeRegistry.newBuilder().add(ret.descriptor).build()); try { parser.merge(data.asJavaString(), ret.builder); @@ -633,6 +641,8 @@ public class RubyMessage extends RubyObject { if (depth > SINK_MAXIMUM_NESTING) { throw context.runtime.newRuntimeError("Maximum recursion depth exceeded during encoding."); } + + // Handle the typical case where the fields.keySet contain the fieldDescriptors for (FieldDescriptor fieldDescriptor : fields.keySet()) { IRubyObject value = fields.get(fieldDescriptor); @@ -648,15 +658,53 @@ public class RubyMessage extends RubyObject { builder.clearField(fieldDescriptor); for (int i = 0; i < repeatedField.size(); i++) { - Object item = convert(context, fieldDescriptor, repeatedField.get(i), depth); + Object item = convert(context, fieldDescriptor, repeatedField.get(i), depth, + /*isDefaultValueForBytes*/ false); builder.addRepeatedField(fieldDescriptor, item); } - } else { - builder.setField(fieldDescriptor, convert(context, fieldDescriptor, value, depth)); + } else if (!value.isNil()) { + /** + * Detect the special case where default_value strings are provided for byte fields. + * If so, disable normal string encoding behavior within convert. + * For a more detailed explanation of other possible workarounds, see the comments + * above {@code com.google.protobuf.Internal#stringDefaultValue() + * stringDefaultValue}. + */ + boolean isDefaultStringForBytes = false; + FieldDescriptor enumFieldDescriptorForType = + this.builder.getDescriptorForType().findFieldByName("type"); + EnumValueDescriptor type = enumFieldDescriptorForType == null ? + null : ((EnumValueDescriptor)this.builder.getField(enumFieldDescriptorForType)); + if (type != null && type.getName().equals("TYPE_BYTES") && + fieldDescriptor.getFullName().equals("google.protobuf.FieldDescriptorProto.default_value")) { + isDefaultStringForBytes = true; + } + builder.setField(fieldDescriptor, convert(context, fieldDescriptor, value, depth, isDefaultStringForBytes)); } } + // Handle cases where {@code fields} doesn't contain the value until after getFieldInternal + // is called - typical of a deserialized message. Skip non-maps and descriptors that already + // have an entry in {@code fields}. + for (FieldDescriptor fieldDescriptor : descriptor.getFields()) { + if (!fieldDescriptor.isMapField()) { + continue; + } + IRubyObject value = fields.get(fieldDescriptor); + if (value!=null) { + continue; + } + value = getFieldInternal(context, fieldDescriptor); + if (value instanceof RubyMap) { + builder.clearField(fieldDescriptor); + RubyDescriptor mapDescriptor = (RubyDescriptor) getDescriptorForField(context, + fieldDescriptor); + for (DynamicMessage kv : ((RubyMap) value).build(context, mapDescriptor, depth)) { + builder.addRepeatedField(fieldDescriptor, kv); + } + } + } return builder.build(); } @@ -667,7 +715,7 @@ public class RubyMessage extends RubyObject { if (fdef.isRepeated()) { copy.fields.put(fdef, this.getRepeatedField(context, fdef).deepCopy(context)); } else if (fields.containsKey(fdef)) { - copy.fields.put(fdef, fields.get(fdef)); + copy.setFieldInternal(context, fdef, fields.get(fdef)); } else if (builder.hasField(fdef)) { copy.fields.put(fdef, wrapField(context, fdef, builder.getField(fdef))); } @@ -691,7 +739,9 @@ public class RubyMessage extends RubyObject { protected IRubyObject hasField(ThreadContext context, FieldDescriptor fieldDescriptor) { validateMessageType(context, fieldDescriptor, "has?"); - if (!fieldHasPresence(fieldDescriptor)) throw context.runtime.newArgumentError("does not track presence"); + if (!fieldDescriptor.hasPresence()) { + throw context.runtime.newArgumentError("does not track presence"); + } return fields.containsKey(fieldDescriptor) ? context.runtime.getTrue() : context.runtime.getFalse(); } @@ -762,19 +812,24 @@ public class RubyMessage extends RubyObject { // convert a ruby object to protobuf type, skip type check since it is checked on the way in private Object convert(ThreadContext context, FieldDescriptor fieldDescriptor, - IRubyObject value, int depth) { - Ruby runtime = context.runtime; + IRubyObject value, int depth, boolean isDefaultStringForBytes) { Object val = null; switch (fieldDescriptor.getType()) { case INT32: + case SFIXED32: + case SINT32: val = RubyNumeric.num2int(value); break; case INT64: + case SFIXED64: + case SINT64: val = RubyNumeric.num2long(value); break; + case FIXED32: case UINT32: val = Utils.num2uint(value); break; + case FIXED64: case UINT64: val = Utils.num2ulong(context.runtime, value); break; @@ -791,7 +846,11 @@ public class RubyMessage extends RubyObject { val = ByteString.copyFrom(((RubyString) value).getBytes()); break; case STRING: - val = ((RubyString) value).asJavaString(); + if (isDefaultStringForBytes) { + val = ((RubyString) value).getByteList().toString(); + } else { + val = value.asJavaString(); + } break; case MESSAGE: val = ((RubyMessage) value).build(context, depth + 1); @@ -819,6 +878,10 @@ public class RubyMessage extends RubyObject { } private IRubyObject wrapField(ThreadContext context, FieldDescriptor fieldDescriptor, Object value) { + return wrapField(context, fieldDescriptor, value, false); + } + + private IRubyObject wrapField(ThreadContext context, FieldDescriptor fieldDescriptor, Object value, boolean encodeBytes) { if (value == null) { return context.runtime.getNil(); } @@ -827,6 +890,12 @@ public class RubyMessage extends RubyObject { switch (fieldDescriptor.getType()) { case INT32: case INT64: + case FIXED32: + case SINT32: + case FIXED64: + case SINT64: + case SFIXED64: + case SFIXED32: case UINT32: case UINT64: case FLOAT: @@ -834,7 +903,7 @@ public class RubyMessage extends RubyObject { case BOOL: case BYTES: case STRING: - return Utils.wrapPrimaryValue(context, fieldDescriptor.getType(), value); + return Utils.wrapPrimaryValue(context, fieldDescriptor.getType(), value, encodeBytes); case MESSAGE: RubyClass typeClass = (RubyClass) ((RubyDescriptor) getDescriptorForField(context, fieldDescriptor)).msgclass(context); RubyMessage msg = (RubyMessage) typeClass.newInstance(context, Block.NULL_BLOCK); @@ -872,22 +941,44 @@ public class RubyMessage extends RubyObject { return getFieldInternal(context, fieldDescriptor, true); } - private IRubyObject getFieldInternal(ThreadContext context, FieldDescriptor fieldDescriptor, boolean returnDefaults) { + private IRubyObject getFieldInternal(ThreadContext context, FieldDescriptor fieldDescriptor, + boolean returnDefaults) { OneofDescriptor oneofDescriptor = fieldDescriptor.getContainingOneof(); if (oneofDescriptor != null) { if (oneofCases.get(oneofDescriptor) == fieldDescriptor) { - return fields.get(fieldDescriptor); + IRubyObject value = fields.get(fieldDescriptor); + if (value == null) { + FieldDescriptor oneofCase = builder.getOneofFieldDescriptor(oneofDescriptor); + if (oneofCase != null) { + Object builderValue = builder.getField(oneofCase); + if (builderValue != null) { + boolean encodeBytes = oneofCase.hasDefaultValue() && builderValue.equals(oneofCase.getDefaultValue()); + value = wrapField(context, oneofCase, builderValue, encodeBytes); + } + } + if (value == null) { + return context.nil; + } else { + return value; + } + } else { + return value; + } } else { FieldDescriptor oneofCase = builder.getOneofFieldDescriptor(oneofDescriptor); if (oneofCase != fieldDescriptor) { - if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE || !returnDefaults) { - return context.nil; - } else { - return wrapField(context, fieldDescriptor, fieldDescriptor.getDefaultValue()); - } + if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE + || !returnDefaults) { + return context.nil; + } else { + return wrapField(context, fieldDescriptor, + fieldDescriptor.getDefaultValue(), true); + } } if (returnDefaults || builder.hasField(fieldDescriptor)) { - IRubyObject value = wrapField(context, oneofCase, builder.getField(oneofCase)); + Object rawValue = builder.getField(oneofCase); + boolean encodeBytes = oneofCase.hasDefaultValue() && rawValue.equals(oneofCase.getDefaultValue()); + IRubyObject value = wrapField(context, oneofCase, rawValue, encodeBytes); fields.put(fieldDescriptor, value); return value; } else { @@ -896,7 +987,7 @@ public class RubyMessage extends RubyObject { } } - if (Utils.isMapEntry(fieldDescriptor)) { + if (fieldDescriptor.isMapField()) { RubyMap map = (RubyMap) fields.get(fieldDescriptor); if (map == null) { map = newMapForField(context, fieldDescriptor); @@ -925,7 +1016,9 @@ public class RubyMessage extends RubyObject { if (fields.containsKey(fieldDescriptor)) { return fields.get(fieldDescriptor); } else if (returnDefaults || builder.hasField(fieldDescriptor)) { - IRubyObject value = wrapField(context, fieldDescriptor, builder.getField(fieldDescriptor)); + Object rawValue = builder.getField(fieldDescriptor); + boolean encodeBytes = fieldDescriptor.hasDefaultValue() && rawValue.equals(fieldDescriptor.getDefaultValue()); + IRubyObject value = wrapField(context, fieldDescriptor, rawValue, encodeBytes); if (builder.hasField(fieldDescriptor)) { fields.put(fieldDescriptor, value); } @@ -938,7 +1031,7 @@ public class RubyMessage extends RubyObject { private IRubyObject setFieldInternal(ThreadContext context, FieldDescriptor fieldDescriptor, IRubyObject value) { testFrozen("can't modify frozen " + getMetaClass()); - if (Utils.isMapEntry(fieldDescriptor)) { + if (fieldDescriptor.isMapField()) { if (!(value instanceof RubyMap)) { throw Utils.createTypeError(context, "Expected Map instance"); } @@ -980,7 +1073,9 @@ public class RubyMessage extends RubyObject { // Keep track of what Oneofs are set if (value.isNil()) { oneofCases.remove(oneofDescriptor); - addValue = false; + if (!oneofDescriptor.isSynthetic()) { + addValue = false; + } } else { oneofCases.put(oneofDescriptor, fieldDescriptor); } @@ -1019,20 +1114,12 @@ public class RubyMessage extends RubyObject { return context.runtime.newSymbol("UNKNOWN"); } - private boolean fieldHasPresence(FieldDescriptor fieldDescriptor) { - return !fieldDescriptor.isRepeated() && - (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE || - fieldDescriptor.getContainingOneof() != null || - !proto3); - } - private RubyRepeatedField rubyToRepeatedField(ThreadContext context, FieldDescriptor fieldDescriptor, IRubyObject value) { RubyArray arr = value.convertToArray(); RubyRepeatedField repeatedField = repeatedFieldForFieldDescriptor(context, fieldDescriptor); IRubyObject[] values = new IRubyObject[arr.size()]; FieldDescriptor.Type fieldType = fieldDescriptor.getType(); - String fieldName = fieldDescriptor.getName(); RubyModule typeClass = null; if (fieldType == FieldDescriptor.Type.MESSAGE) { @@ -1045,8 +1132,11 @@ public class RubyMessage extends RubyObject { for (int i = 0; i < arr.size(); i++) { IRubyObject item = arr.eltInternal(i); + if (item.isNil()) { + throw Utils.createTypeError(context, "nil message not allowed here."); + } if (item instanceof RubyHash && typeClass != null) { - values[i] = (IRubyObject) ((RubyClass) typeClass).newInstance(context, item, Block.NULL_BLOCK); + values[i] = ((RubyClass) typeClass).newInstance(context, item, Block.NULL_BLOCK); } else { if (fieldType == FieldDescriptor.Type.ENUM) { item = enumToSymbol(context, fieldDescriptor.getEnumType(), item); @@ -1086,13 +1176,6 @@ public class RubyMessage extends RubyObject { } } - private FieldDescriptor getOneofCase(OneofDescriptor oneof) { - if (oneofCases.containsKey(oneof)) { - return oneofCases.get(oneof); - } - return builder.getOneofFieldDescriptor(oneof); - } - private boolean isWrappable(FieldDescriptor fieldDescriptor) { if (fieldDescriptor.getType() != FieldDescriptor.Type.MESSAGE) return false; @@ -1118,7 +1201,7 @@ public class RubyMessage extends RubyObject { private void validateMessageType(ThreadContext context, FieldDescriptor fieldDescriptor, String methodName) { if (descriptor != fieldDescriptor.getContainingType()) { - throw context.runtime.newTypeError(methodName + " method called on wrong message type"); + throw Utils.createTypeError(context, methodName + " method called on wrong message type"); } } @@ -1139,6 +1222,4 @@ public class RubyMessage extends RubyObject { private RubyClass cMap; private boolean ignoreUnknownFieldsOnInit = false; private boolean proto3; - - } diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java deleted file mode 100644 index 211236c48a..0000000000 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Protocol Buffers - Google's data interchange format - * Copyright 2014 Google Inc. All rights reserved. - * https://developers.google.com/protocol-buffers/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.google.protobuf.jruby; - -import com.google.protobuf.DescriptorProtos.DescriptorProto; -import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; -import com.google.protobuf.DescriptorProtos.OneofDescriptorProto; -import org.jruby.*; -import org.jruby.anno.JRubyClass; -import org.jruby.anno.JRubyMethod; -import org.jruby.runtime.Binding; -import org.jruby.runtime.Block; -import org.jruby.runtime.ObjectAllocator; -import org.jruby.runtime.ThreadContext; -import org.jruby.runtime.builtin.IRubyObject; - -@JRubyClass(name = "MessageBuilderContext") -public class RubyMessageBuilderContext extends RubyObject { - public static void createRubyMessageBuilderContext(Ruby runtime) { - RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal"); - RubyClass cMessageBuilderContext = internal.defineClassUnder("MessageBuilderContext", runtime.getObject(), new ObjectAllocator() { - @Override - public IRubyObject allocate(Ruby runtime, RubyClass klazz) { - return new RubyMessageBuilderContext(runtime, klazz); - } - }); - cMessageBuilderContext.defineAnnotatedMethods(RubyMessageBuilderContext.class); - - cFieldDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::FieldDescriptor"); - cOneofBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::OneofBuilderContext"); - } - - public RubyMessageBuilderContext(Ruby runtime, RubyClass klazz) { - super(runtime, klazz); - } - - @JRubyMethod - public IRubyObject initialize(ThreadContext context, IRubyObject fileBuilderContext, IRubyObject name) { - this.fileBuilderContext = (RubyFileBuilderContext) fileBuilderContext; - this.builder = this.fileBuilderContext.getNewMessageBuilder(); - this.builder.setName(name.asJavaString()); - - return this; - } - - /* - * call-seq: - * MessageBuilderContext.optional(name, type, number, type_class = nil, - * options = nil) - * - * Defines a new optional field on this message type with the given type, tag - * number, and type class (for message and enum fields). The type must be a Ruby - * symbol (as accepted by FieldDescriptor#type=) and the type_class must be a - * string, if present (as accepted by FieldDescriptor#submsg_name=). - */ - @JRubyMethod(required = 3, optional = 2) - public IRubyObject optional(ThreadContext context, IRubyObject[] args) { - addField(context, OPTIONAL, args, false); - return context.nil; - } - - @JRubyMethod(required = 3, optional = 2) - public IRubyObject proto3_optional(ThreadContext context, IRubyObject[] args) { - addField(context, OPTIONAL, args, true); - return context.nil; - } - - /* - * call-seq: - * MessageBuilderContext.required(name, type, number, type_class = nil, - * options = nil) - * - * Defines a new required field on this message type with the given type, tag - * number, and type class (for message and enum fields). The type must be a Ruby - * symbol (as accepted by FieldDescriptor#type=) and the type_class must be a - * string, if present (as accepted by FieldDescriptor#submsg_name=). - * - * Proto3 does not have required fields, but this method exists for - * completeness. Any attempt to add a message type with required fields to a - * pool will currently result in an error. - */ - @JRubyMethod(required = 3, optional = 2) - public IRubyObject required(ThreadContext context, IRubyObject[] args) { - if (fileBuilderContext.isProto3()) throw Utils.createTypeError(context, "Required fields are unsupported in proto3"); - addField(context, "required", args, false); - return context.nil; - } - - /* - * call-seq: - * MessageBuilderContext.repeated(name, type, number, type_class = nil) - * - * Defines a new repeated field on this message type with the given type, tag - * number, and type class (for message and enum fields). The type must be a Ruby - * symbol (as accepted by FieldDescriptor#type=) and the type_class must be a - * string, if present (as accepted by FieldDescriptor#submsg_name=). - */ - @JRubyMethod(required = 3, optional = 1) - public IRubyObject repeated(ThreadContext context, IRubyObject[] args) { - addField(context, "repeated", args, false); - return context.nil; - } - - /* - * call-seq: - * MessageBuilderContext.map(name, key_type, value_type, number, - * value_type_class = nil) - * - * Defines a new map field on this message type with the given key and value - * types, tag number, and type class (for message and enum value types). The key - * type must be :int32/:uint32/:int64/:uint64, :bool, or :string. The value type - * type must be a Ruby symbol (as accepted by FieldDescriptor#type=) and the - * type_class must be a string, if present (as accepted by - * FieldDescriptor#submsg_name=). - */ - @JRubyMethod(required = 4, optional = 1) - public IRubyObject map(ThreadContext context, IRubyObject[] args) { - Ruby runtime = context.runtime; - if (!fileBuilderContext.isProto3()) throw runtime.newArgumentError("Cannot add a native map field using proto2 syntax."); - - RubySymbol messageSym = runtime.newSymbol("message"); - - IRubyObject name = args[0]; - IRubyObject keyType = args[1]; - IRubyObject valueType = args[2]; - IRubyObject number = args[3]; - IRubyObject typeClass = args.length > 4 ? args[4] : context.nil; - - // Validate the key type. We can't accept enums, messages, or floats/doubles - // as map keys. (We exclude these explicitly, and the field-descriptor setter - // below then ensures that the type is one of the remaining valid options.) - if (keyType.equals(runtime.newSymbol("float")) || - keyType.equals(runtime.newSymbol("double")) || - keyType.equals(runtime.newSymbol("enum")) || - keyType.equals(messageSym)) - throw runtime.newArgumentError("Cannot add a map field with a float, double, enum, or message type."); - - DescriptorProto.Builder mapEntryBuilder = fileBuilderContext.getNewMessageBuilder(); - mapEntryBuilder.setName(builder.getName() + "_MapEntry_" + name.asJavaString()); - mapEntryBuilder.getOptionsBuilder().setMapEntry(true); - - mapEntryBuilder.addField( - Utils.createFieldBuilder( - context, - OPTIONAL, - new IRubyObject[] { - runtime.newString("key"), - keyType, - runtime.newFixnum(1) - } - ) - ); - - mapEntryBuilder.addField( - Utils.createFieldBuilder( - context, - OPTIONAL, - new IRubyObject[] { - runtime.newString("value"), - valueType, - runtime.newFixnum(2), - typeClass - } - ) - ); - - IRubyObject[] addFieldArgs = { - name, messageSym, number, runtime.newString(mapEntryBuilder.getName()) - }; - - repeated(context, addFieldArgs); - - return context.nil; - } - - /* - * call-seq: - * MessageBuilderContext.oneof(name, &block) => nil - * - * Creates a new OneofDescriptor with the given name, creates a - * OneofBuilderContext attached to that OneofDescriptor, evaluates the given - * block in the context of that OneofBuilderContext with #instance_eval, and - * then adds the oneof to the message. - * - * This is the recommended, idiomatic way to build oneof definitions. - */ - @JRubyMethod - public IRubyObject oneof(ThreadContext context, IRubyObject name, Block block) { - RubyOneofBuilderContext ctx = (RubyOneofBuilderContext) - cOneofBuilderContext.newInstance( - context, - context.runtime.newFixnum(builder.getOneofDeclCount()), - this, - Block.NULL_BLOCK - ); - - builder.addOneofDeclBuilder().setName(name.asJavaString()); - ctx.instance_eval(context, block); - - return context.nil; - } - - protected void addFieldBuilder(FieldDescriptorProto.Builder fieldBuilder) { - builder.addField(fieldBuilder); - } - - private FieldDescriptorProto.Builder addField(ThreadContext context, String label, IRubyObject[] args, boolean proto3Optional) { - FieldDescriptorProto.Builder fieldBuilder = - Utils.createFieldBuilder(context, label, args); - - fieldBuilder.setProto3Optional(proto3Optional); - builder.addField(fieldBuilder); - - return fieldBuilder; - } - - private static RubyClass cFieldDescriptor; - private static RubyClass cOneofBuilderContext; - - private static final String OPTIONAL = "optional"; - - private DescriptorProto.Builder builder; - private RubyClass cDescriptor; - private RubyFileBuilderContext fileBuilderContext; -} diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java deleted file mode 100644 index 1ce500e3aa..0000000000 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Protocol Buffers - Google's data interchange format - * Copyright 2014 Google Inc. All rights reserved. - * https://developers.google.com/protocol-buffers/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.google.protobuf.jruby; - -import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; -import org.jruby.Ruby; -import org.jruby.RubyClass; -import org.jruby.RubyHash; -import org.jruby.RubyModule; -import org.jruby.RubyNumeric; -import org.jruby.RubyObject; -import org.jruby.anno.JRubyClass; -import org.jruby.anno.JRubyMethod; -import org.jruby.runtime.ObjectAllocator; -import org.jruby.runtime.ThreadContext; -import org.jruby.runtime.builtin.IRubyObject; - -@JRubyClass(name = "OneofBuilderContext") -public class RubyOneofBuilderContext extends RubyObject { - public static void createRubyOneofBuilderContext(Ruby runtime) { - RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal"); - RubyClass cRubyOneofBuidlerContext = internal.defineClassUnder("OneofBuilderContext", runtime.getObject(), new ObjectAllocator() { - @Override - public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) { - return new RubyOneofBuilderContext(ruby, rubyClass); - } - }); - cRubyOneofBuidlerContext.defineAnnotatedMethods(RubyOneofBuilderContext.class); - } - - public RubyOneofBuilderContext(Ruby ruby, RubyClass rubyClass) { - super(ruby, rubyClass); - } - - /* - * call-seq: - * OneofBuilderContext.new(oneof_index, message_builder) => context - * - * Create a new oneof builder context around the given oneof descriptor and - * builder context. This class is intended to serve as a DSL context to be used - * with #instance_eval. - */ - @JRubyMethod - public IRubyObject initialize(ThreadContext context, IRubyObject index, IRubyObject messageBuilder) { - this.builder = (RubyMessageBuilderContext) messageBuilder; - this.index = RubyNumeric.num2int(index); - - return this; - } - - /* - * call-seq: - * OneofBuilderContext.optional(name, type, number, type_class = nil, - * options = nil) - * - * Defines a new optional field in this oneof with the given type, tag number, - * and type class (for message and enum fields). The type must be a Ruby symbol - * (as accepted by FieldDescriptor#type=) and the type_class must be a string, - * if present (as accepted by FieldDescriptor#submsg_name=). - */ - @JRubyMethod(required = 3, optional = 2) - public IRubyObject optional(ThreadContext context, IRubyObject[] args) { - FieldDescriptorProto.Builder fieldBuilder = - Utils.createFieldBuilder(context, "optional", args); - fieldBuilder.setOneofIndex(index); - builder.addFieldBuilder(fieldBuilder); - - return context.nil; - } - - private RubyMessageBuilderContext builder; - private int index; -} diff --git a/ruby/src/main/java/com/google/protobuf/jruby/Utils.java b/ruby/src/main/java/com/google/protobuf/jruby/Utils.java index 17c1c8d7bc..cd2758962e 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/Utils.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/Utils.java @@ -35,7 +35,6 @@ package com.google.protobuf.jruby; import com.google.protobuf.ByteString; import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; import com.google.protobuf.Descriptors.FieldDescriptor; -import org.jcodings.Encoding; import org.jcodings.specific.ASCIIEncoding; import org.jruby.*; import org.jruby.exceptions.RaiseException; @@ -70,6 +69,12 @@ public class Utils { Ruby runtime = context.runtime; switch(fieldType) { + case SFIXED32: + case SFIXED64: + case FIXED64: + case SINT64: + case SINT32: + case FIXED32: case INT32: case INT64: case UINT32: @@ -83,7 +88,8 @@ public class Utils { throw runtime.newRangeError("Non-integral floating point value assigned to integer field '" + fieldName + "' (given " + value.getMetaClass() + ")."); } } - if (fieldType == FieldDescriptor.Type.UINT32 || fieldType == FieldDescriptor.Type.UINT64) { + if (fieldType == FieldDescriptor.Type.UINT32 || fieldType == FieldDescriptor.Type.UINT64 || + fieldType == FieldDescriptor.Type.FIXED32 || fieldType == FieldDescriptor.Type.FIXED64) { if (((RubyNumeric) value).isNegative()) { throw runtime.newRangeError("Assigning negative value to unsigned integer field '" + fieldName + "' (given " + value.getMetaClass() + ")."); } @@ -94,9 +100,11 @@ public class Utils { RubyNumeric.num2int(value); break; case UINT32: + case FIXED32: num2uint(value); break; case UINT64: + case FIXED64: num2ulong(context.runtime, value); break; default: @@ -183,14 +191,24 @@ public class Utils { } public static IRubyObject wrapPrimaryValue(ThreadContext context, FieldDescriptor.Type fieldType, Object value) { + return wrapPrimaryValue(context, fieldType, value, false); + } + + public static IRubyObject wrapPrimaryValue(ThreadContext context, FieldDescriptor.Type fieldType, Object value, boolean encodeBytes) { Ruby runtime = context.runtime; switch (fieldType) { case INT32: + case SFIXED32: + case SINT32: return runtime.newFixnum((Integer) value); + case SFIXED64: + case SINT64: case INT64: return runtime.newFixnum((Long) value); + case FIXED32: case UINT32: return runtime.newFixnum(((Integer) value) & (-1l >>> 32)); + case FIXED64: case UINT64: long ret = (Long) value; return ret >= 0 ? runtime.newFixnum(ret) : @@ -202,7 +220,9 @@ public class Utils { case BOOL: return (Boolean) value ? runtime.getTrue() : runtime.getFalse(); case BYTES: { - IRubyObject wrapped = RubyString.newString(runtime, ((ByteString) value).toStringUtf8(), ASCIIEncoding.INSTANCE); + IRubyObject wrapped = encodeBytes ? + RubyString.newString(runtime, ((ByteString) value).toStringUtf8(), ASCIIEncoding.INSTANCE) : + RubyString.newString(runtime, ((ByteString) value).toByteArray()); wrapped.setFrozen(true); return wrapped; } @@ -260,58 +280,6 @@ public class Utils { fieldDescriptor.getMessageType().getOptions().getMapEntry(); } - /* - * call-seq: - * Utils.createFieldBuilder(context, label, name, type, number, typeClass = nil, options = nil) - * - * Most places calling this are already dealing with an optional number of - * arguments so dealing with them here. This helper is a standard way to - * create a FieldDescriptor builder that handles some of the options that - * are used in different places. - */ - public static FieldDescriptorProto.Builder createFieldBuilder(ThreadContext context, - String label, IRubyObject[] args) { - - Ruby runtime = context.runtime; - IRubyObject options = context.nil; - IRubyObject typeClass = context.nil; - - if (args.length > 4) { - options = args[4]; - typeClass = args[3]; - } else if (args.length > 3) { - if (args[3] instanceof RubyHash) { - options = args[3]; - } else { - typeClass = args[3]; - } - } - - FieldDescriptorProto.Builder builder = FieldDescriptorProto.newBuilder(); - - builder.setLabel(FieldDescriptorProto.Label.valueOf("LABEL_" + label.toUpperCase())) - .setName(args[0].asJavaString()) - .setNumber(RubyNumeric.num2int(args[2])) - .setType(FieldDescriptorProto.Type.valueOf("TYPE_" + args[1].asJavaString().toUpperCase())); - - if (!typeClass.isNil()) { - if (!(typeClass instanceof RubyString)) { - throw runtime.newArgumentError("expected string for type class"); - } - builder.setTypeName("." + typeClass.asJavaString()); - } - - if (options instanceof RubyHash) { - IRubyObject defaultValue = ((RubyHash) options).fastARef(runtime.newSymbol("default")); - if (defaultValue != null) { - builder.setDefaultValue(defaultValue.toString()); - } - } - - return builder; - } - - public static RaiseException createTypeError(ThreadContext context, String message) { if (cTypeError == null) { cTypeError = (RubyClass) context.runtime.getClassFromPath("Google::Protobuf::TypeError"); diff --git a/ruby/src/main/java/google/ProtobufJavaService.java b/ruby/src/main/java/google/ProtobufJavaService.java index a364719400..713891e1c1 100644 --- a/ruby/src/main/java/google/ProtobufJavaService.java +++ b/ruby/src/main/java/google/ProtobufJavaService.java @@ -49,18 +49,13 @@ public class ProtobufJavaService implements BasicLibraryService { * need to exist before we try to save a reference to them */ RubyProtobuf.createProtobuf(ruby); - RubyBuilder.createRubyBuilder(ruby); RubyFileDescriptor.createRubyFileDescriptor(ruby); RubyEnumDescriptor.createRubyEnumDescriptor(ruby); - RubyEnumBuilderContext.createRubyEnumBuilderContext(ruby); RubyRepeatedField.createRubyRepeatedField(ruby); RubyFieldDescriptor.createRubyFieldDescriptor(ruby); RubyMap.createRubyMap(ruby); RubyOneofDescriptor.createRubyOneofDescriptor(ruby); - RubyOneofBuilderContext.createRubyOneofBuilderContext(ruby); - RubyMessageBuilderContext.createRubyMessageBuilderContext(ruby); RubyDescriptor.createRubyDescriptor(ruby); - RubyFileBuilderContext.createRubyFileBuilderContext(ruby); RubyDescriptorPool.createRubyDescriptorPool(ruby); return true; } diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb index ed15bde0eb..2a7a251f2e 100755 --- a/ruby/tests/basic.rb +++ b/ruby/tests/basic.rb @@ -66,7 +66,8 @@ module BasicTest def test_issue_8559_crash msg = TestMessage.new msg.repeated_int32 = ::Google::Protobuf::RepeatedField.new(:int32, [1, 2, 3]) - GC.start(full_mark: true, immediate_sweep: true) + # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0 + GC.start(full_mark: true, immediate_sweep: true) unless RUBY_PLATFORM == "java" TestMessage.encode(msg) end diff --git a/ruby/tests/common_tests.rb b/ruby/tests/common_tests.rb index 7021d600a5..3d9f67eb93 100644 --- a/ruby/tests/common_tests.rb +++ b/ruby/tests/common_tests.rb @@ -1781,21 +1781,24 @@ module CommonTests def test_object_gc m = proto_module::TestMessage.new(optional_msg: proto_module::TestMessage2.new) m.optional_msg - GC.start(full_mark: true, immediate_sweep: true) + # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0 + GC.start(full_mark: true, immediate_sweep: true) unless RUBY_PLATFORM == "java" m.optional_msg.inspect end def test_object_gc_freeze m = proto_module::TestMessage.new m.repeated_float.freeze - GC.start(full_mark: true) + # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0 + GC.start(full_mark: true) unless RUBY_PLATFORM == "java" # Make sure we remember that the object is frozen. # The wrapper object contains this information, so we need to ensure that # the previous GC did not collect it. assert m.repeated_float.frozen? - GC.start(full_mark: true, immediate_sweep: true) + # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0 + GC.start(full_mark: true, immediate_sweep: true) unless RUBY_PLATFORM == "java" assert m.repeated_float.frozen? end end diff --git a/ruby/tests/stress.rb b/ruby/tests/stress.rb index 082d5e22df..6a3f51d8a5 100755 --- a/ruby/tests/stress.rb +++ b/ruby/tests/stress.rb @@ -30,7 +30,7 @@ module StressTest 100_000.times do mnew = TestMessage.decode(data) mnew = mnew.dup - assert_equal mnew.inspect, m.inspect + assert_equal m.inspect, mnew.inspect assert TestMessage.encode(mnew) == data end end diff --git a/ruby/travis-test.sh b/ruby/travis-test.sh index b57d8b2db9..1f6aea57c5 100755 --- a/ruby/travis-test.sh +++ b/ruby/travis-test.sh @@ -13,7 +13,7 @@ test_version() { "rvm install $version && rvm use $version && rvm get head && \ which ruby && \ git clean -f && \ - gem install bundler && bundle && \ + gem install --no-document bundler && bundle && \ rake test && rake gc_test && cd ../conformance && make test_jruby && @@ -23,7 +23,7 @@ test_version() { "rvm install $version && rvm use $version && \ which ruby && \ git clean -f && \ - gem install bundler -v 1.17.3 && bundle && \ + gem install --no-document bundler -v 1.17.3 && bundle && \ rake test && rake gc_test && cd ../conformance && make ${RUBY_CONFORMANCE} &&