Skip to content

Conversation

copybara-service[bot]
Copy link

Remove test calls to registerSchemaOverride from BinaryProtocolTest.

I don't think it's necessary. If we don't register the schema, it's lazily created later in Protobuf.schemaFor anyway: http://google3/third_party/java_src/protobuf/current/java/com/google/protobuf/Protobuf.java;l=67-70;rcl=793795963

The test still passes without this. I think this setUp is vestigial.

TestSchemas and Protobuf.schemaFor both use equivalent factories (new ManifestSchemaFactory()) to create these anyway:

I'm trying to limit calls to registerSchemaOverride to see if we can remove it and make future usages of ClassValue inside Protobuf easier.

Also, registerSchemaOverride is not used by production code, so using it here makes the test less representative of production workloads.

History: this was added in 2016: https://critique.corp.google.com/cl/129882307/depot/google3/javatests/com/google/frameworks/protobuf/experimental/testing/BinaryProtocolTest.java

Back then, the Protobuf constructor chose different schema factories depending on platform: http://google3/third_party/java_src/protobuf/current/java/com/google/protobuf/Protobuf.java;l=93-110;drf=google3%2Fjava%2Fcom%2Fgoogle%2Fframeworks%2Fprotobuf%2Fexperimental%2FProtobuf.java;rcl=128834824.

This is not the case any more. This code was removed in cl/218868944.

I don't think it's necessary. If we don't register the schema, it's lazily created later in Protobuf.schemaFor anyway: http://google3/third_party/java_src/protobuf/current/java/com/google/protobuf/Protobuf.java;l=67-70;rcl=793795963

The test still passes without this. I think this setUp is vestigial.

TestSchemas and Protobuf.schemaFor both use equivalent factories (`new ManifestSchemaFactory()`) to create these anyway:
- http://google3/third_party/java_src/protobuf/current/javatests/com/google/protobuf/TestSchemas.java;l=31;rcl=753677581
- http://google3/third_party/java_src/protobuf/current/java/com/google/protobuf/Protobuf.java;l=116;rcl=793795963

I'm trying to limit calls to registerSchemaOverride to see if we can remove it and make future usages of ClassValue inside Protobuf easier.

Also, registerSchemaOverride is not used by production code, so using it here makes the test less representative of production workloads.

History: this was added in 2016: https://critique.corp.google.com/cl/129882307/depot/google3/javatests/com/google/frameworks/protobuf/experimental/testing/BinaryProtocolTest.java

Back then, the Protobuf constructor chose different schema factories depending on platform: http://google3/third_party/java_src/protobuf/current/java/com/google/protobuf/Protobuf.java;l=93-110;drf=google3%2Fjava%2Fcom%2Fgoogle%2Fframeworks%2Fprotobuf%2Fexperimental%2FProtobuf.java;rcl=128834824.

This is not the case any more. This code was removed in cl/218868944.

PiperOrigin-RevId: 814077051
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant