Skip to content

Conversation

@copybara-service
Copy link

Remove test calls to registerSchemaOverride.

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.

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/140601668/depot/google3/javatests/com/google/protobuf/CodedAdapterTest.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=104-121;drf=google3%2Fjava%2Fcom%2Fgoogle%2Fprotobuf%2FProtobuf.java;rcl=139844860

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

PiperOrigin-RevId: 816188472
@copybara-service copybara-service bot merged commit 7c790f7 into main Oct 7, 2025
@copybara-service copybara-service bot deleted the test_814075819 branch October 7, 2025 14:04
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.

2 participants