Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for upgrade to Protobuf 4 by removing deprecated or removed calls #3260

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,9 @@ private void validateMessage(@Nonnull Descriptor oldDescriptor, @Nonnull Descrip
}
}

@SuppressWarnings("deprecation") // checks the deprecated syntax field
private void validateProtoSyntax(@Nonnull Descriptors.Descriptor oldDescriptor, @Nonnull Descriptors.Descriptor newDescriptor) {
if (!oldDescriptor.getFile().getSyntax().equals(newDescriptor.getFile().getSyntax())
|| !oldDescriptor.getFile().getEdition().equals(newDescriptor.getFile().getEdition())) {
if (!oldDescriptor.getFile().toProto().getSyntax().equals(newDescriptor.getFile().toProto().getSyntax())
|| !oldDescriptor.getFile().toProto().getEdition().equals(newDescriptor.getFile().toProto().getEdition())) {
throw new MetaDataException("message descriptor proto syntax changed",
LogMessageKeys.RECORD_TYPE, oldDescriptor.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void nestedProto2ToProto3() {
@SuppressWarnings("deprecation") // test focuses on checking the (deprecated) syntax field
@Test
public void onlyFileProto2ToProto3() throws InvalidProtocolBufferException {
assertNotEquals(TestRecords1Proto.getDescriptor().getSyntax(), TestRecords1ImportedProto.getDescriptor().getSyntax());
assertNotEquals(TestRecords1Proto.getDescriptor().toProto().getSyntax(), TestRecords1ImportedProto.getDescriptor().toProto().getSyntax());
MetaDataEvolutionValidator.getDefaultInstance().validateUnion(
TestRecords1Proto.RecordTypeUnion.getDescriptor(),
TestRecords1ImportedProto.RecordTypeUnion.getDescriptor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ static void simpleJDBCServiceClientOperation(ManagedChannel managedChannel) {
} catch (Throwable t) {
com.google.rpc.Status status = StatusProto.fromThrowable(t);
if (status != null) {
logger.fatal(t + ", " + TextFormat.shortDebugString(status));
// V3: printer().shortDebugString(status)
// V4: printer().emittingSingleLine(true).printToString(status)
logger.fatal(t + ", " + TextFormat.printer().printToString(status).replace("\n", " "));
}
throw t;
} finally {
Expand Down
1 change: 1 addition & 0 deletions yaml-tests/yaml-tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dependencies {
implementation(libs.junit.api)
implementation(libs.junit.params)
implementation(libs.log4j.api)
implementation(libs.guava)
implementation(libs.protobuf)
implementation(libs.protobuf.util)
implementation(libs.snakeyaml)
Expand Down
Loading