code: public static void getDeclaredFields(Class c, Collection<Field> fields) {
          try
          {
              Field[] local = c.getDeclaredFields();
  
              for (Field field : local)
              {
                  if (!field.isAccessible())
                  {
                      try
                      {
                          field.setAccessible(true);
                      }
                      catch (Exception ignored) { }
                  }
  
                  int modifiers = field.getModifiers();
                  if (!Modifier.isStatic(modifiers) &&
                          !field.getName().startsWith("this$") &&
                          !Modifier.isTransient(modifiers))
                  {   // speed up: do not count static fields, do not go back up to enclosing object in nested case, do not consider transients
                      fields.add(field);
                  }
              }
          }
          catch (Throwable ignored)
          {
              ExceptionUtilities.safelyIgnoreException(ignored);
          }
  
      }
docs: Get all non static, non transient, fields of the passed in class, including
  private fields. Note, the special this$ field is also not returned.  The
  resulting fields are stored in a Collection.
  @param c Class instance
  that would need further processing (reference fields).  This
  makes field traversal on a class faster as it does not need to
  continually process known fields like primitives.