From 3d76a0425936c8d65766a3c058ccee6e66d30b9d Mon Sep 17 00:00:00 2001 From: PhongChuong Date: Thu, 24 Oct 2024 16:03:08 -0400 Subject: [PATCH] fix: update BigQuerySchemaUtil to use non-deprecated hasExtension This is to unblock protocol buffer version updates. --- .../cloud/bigquery/storage/v1/BigQuerySchemaUtil.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BigQuerySchemaUtil.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BigQuerySchemaUtil.java index aebfc59a51..5e0e9ae56f 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BigQuerySchemaUtil.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BigQuerySchemaUtil.java @@ -15,7 +15,9 @@ */ package com.google.cloud.bigquery.storage.v1; +import com.google.protobuf.DescriptorProtos.FieldOptions; import com.google.protobuf.Descriptors.FieldDescriptor; +import com.google.protobuf.ExtensionLite; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -74,8 +76,12 @@ public static String generatePlaceholderFieldName(String fieldName) { * @return columnName annotation if present, otherwise return the field name. */ public static String getFieldName(FieldDescriptor fieldDescriptor) { - return fieldDescriptor.getOptions().hasExtension(AnnotationsProto.columnName) - ? fieldDescriptor.getOptions().getExtension(AnnotationsProto.columnName) + return fieldDescriptor + .getOptions() + .hasExtension((ExtensionLite) AnnotationsProto.columnName) + ? fieldDescriptor + .getOptions() + .getExtension((ExtensionLite) AnnotationsProto.columnName) : fieldDescriptor.getName(); } }