code: @SuppressWarnings({"unchecked", "rawtypes"})
    public void setField(final FieldDescriptorType descriptor,
                         Object value) {
      if (descriptor.isRepeated()) {
        if (!(value instanceof List)) {
          throw new IllegalArgumentException(
            "Wrong object type used with protocol message reflection.");
        }
  
        // Wrap the contents in a new list so that the caller cannot change
        // the list's contents after setting it.
        final List newList = new ArrayList();
        newList.addAll((List) value);
        for (final Object element : newList) {
          verifyType(descriptor.getLiteType(), element);
        }
        value = newList;
      } else {
        verifyType(descriptor.getLiteType(), value);
      }
  
      if (value instanceof LazyField) {
        hasLazyField = true;
      }
      fields.put(descriptor, value);
    }
docs: Useful for implementing
  {@link Message.Builder#setField(Descriptors.FieldDescriptor,Object)}.