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 aebfc59a5..5e0e9ae56 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(); } }