@@ -495,6 +495,45 @@ private static FileDescriptor[] findDescriptors(
495495return descriptors .toArray (new FileDescriptor [0 ]);
496496 }
497497
498+ /**
499+ * This method is for backward compatibility with generated code which passed an
500+ * InternalDescriptorAssigner.
501+ *
502+ * @deprecated Any gencode which is using this method is far out of support and should be
503+ * regenerated with a newer version of the protobuf compiler.
504+ */
505+ @ Deprecated
506+ public static void internalBuildGeneratedFileFrom (
507+ final String []descriptorDataParts ,
508+ final FileDescriptor []dependencies ,
509+ final InternalDescriptorAssigner descriptorAssigner ) {
510+ final byte []descriptorBytes =latin1Cat (descriptorDataParts );
511+
512+ FileDescriptorProto proto ;
513+ try {
514+ proto =FileDescriptorProto .parseFrom (descriptorBytes );
515+ }catch (InvalidProtocolBufferException e ) {
516+ throw new IllegalArgumentException (
517+ "Failed to parse protocol buffer descriptor for generated code." ,e );
518+ }
519+
520+ final FileDescriptor result ;
521+ try {
522+ // When building descriptors for generated code, we allow unknown
523+ // dependencies by default.
524+ result =buildFrom (proto ,dependencies ,true );
525+ }catch (DescriptorValidationException e ) {
526+ throw new IllegalArgumentException (
527+ "Invalid embedded descriptor for\" " +proto .getName () +"\" ." ,e );
528+ }
529+
530+ final ExtensionRegistry registry =descriptorAssigner .assignDescriptors (result );
531+
532+ if (registry !=null ) {
533+ throw new RuntimeException ("assignDescriptors must return null" );
534+ }
535+ }
536+
498537/**
499538 * This method is to be called by generated code only. It is equivalent to {@code buildFrom}
500539 * except that the {@code FileDescriptorProto} is encoded in protocol buffer wire format.