code: static boolean fieldIsSerializable(final Field field, final boolean onlySerializePublicFields) {
          final int modifiers = field.getModifiers();
          if ((!onlySerializePublicFields || Modifier.isPublic(modifiers)) && !Modifier.isTransient(modifiers)
                  && !Modifier.isFinal(modifiers) && ((modifiers & 0x1000 /* synthetic */) == 0)) {
              return JSONUtils.isAccessibleOrMakeAccessible(field);
          }
          return false;
      }
docs: Check if a field is serializable. Don't serialize transient, final, synthetic, or inaccessible fields.
  
  <p>
  N.B. Tries to set field to accessible, which will require an "opens" declarations from modules that want to
  allow this introspection.
  
  @param field
  the field
  @param onlySerializePublicFields
  if true, only serialize public fields
  @return true if the field is serializable