code: private static void setField(Object object, Object value, Field foundField) {
          foundField.setAccessible(true);
          try {
              int fieldModifiersMask = foundField.getModifiers();
              removeFinalModifierIfPresent(foundField);
              foundField.set(object, value);
              restoreModifiersToFieldIfChanged(fieldModifiersMask, foundField);
          } catch (IllegalAccessException e) {
              throw new RuntimeException("Internal error: Failed to set field in method setInternalState.", e);
          }
      }
docs: Sets the field.
  
  @param object     the object
  @param value      the value
  @param foundField the found field