|
26 | 26 | import com.google.protobuf.Descriptors; |
27 | 27 | import com.google.protobuf.Descriptors.Descriptor; |
28 | 28 | import com.google.protobuf.Descriptors.FileDescriptor; |
29 | | -import com.google.protobuf.ExtensionLite; |
| 29 | +import com.google.protobuf.Message; |
30 | 30 | import java.util.ArrayList; |
31 | 31 | import java.util.HashMap; |
32 | 32 | import java.util.List; |
@@ -217,13 +217,13 @@ private static FieldDescriptorProto convertBQTableFieldToProtoField( |
217 | 217 | // Sets columnName annotation when field name is not proto comptaible. |
218 | 218 | if (!BigQuerySchemaUtil.isProtoCompatible(fieldName)) { |
219 | 219 | fieldDescriptor.setName(BigQuerySchemaUtil.generatePlaceholderFieldName(fieldName)); |
220 | | - fieldDescriptor.setOptions( |
221 | | - FieldOptions.newBuilder() |
222 | | - .setExtension( |
223 | | - (ExtensionLite<FieldOptions, String>) AnnotationsProto.columnName, |
224 | | - // Remove ExtensionLite after protobuf linkage error is resolved. |
225 | | - fieldName) |
226 | | - .build()); |
| 220 | + |
| 221 | + // The following work around (instead of setting FieldOptions directly) for when |
| 222 | + // FieldOptions.Builder changes from GeneratedMessageV3 in 3.25 to GeneratedMessage in 4.28 as |
| 223 | + // it no longer depends on FieldOptions. |
| 224 | + Message.Builder fieldOptionBuilder = FieldOptions.newBuilder(); |
| 225 | + fieldOptionBuilder.setField(AnnotationsProto.columnName.getDescriptor(), fieldName); |
| 226 | + fieldDescriptor.setOptions((FieldOptions) fieldOptionBuilder.build()); |
227 | 227 | } |
228 | 228 | return fieldDescriptor.build(); |
229 | 229 | } |
|
0 commit comments