code: public static ExtensionRegistry addToRegistry(final FileDescriptor file,
        final ExtensionRegistry registry) {
      for (final FieldDescriptor extension : file.getExtensions()) {
        addToRegistry(extension, registry);
      }
  
      for (final Descriptor descriptor : file.getMessageTypes()) {
        addToRegistry(descriptor, registry);
      }
  
      return registry;
    }
docs: Adds all extensions, without dependencies, for the given FileDescriptor to the registry.