docs: private static Object getFieldVal(final Class<?> cls, final Object obj, final String fieldName,
              final boolean throwException) throws IllegalArgumentException {
          Field field = null;
          for (Class<?> currClass = cls; currClass != null; currClass = currClass.getSuperclass()) {
              try {
                  field = currClass.getDeclaredField(fieldName);
                  // Field found
                  break;
              } catch (final ReflectiveOperationException | SecurityException e) {
                  // Try parent
              }
          }
          if (field == null) {
              if (throwException) {
                  throw new IllegalArgumentException((obj == null ? "Static field " : "Field ") + "\"" + fieldName
                          + "\" not found or not accessible");
              }
          } else {
              try {
                  field.setAccessible(true);
              } catch (final RuntimeException e) { // JDK 9+: InaccessibleObjectException | SecurityException
                  // Ignore
              }
              try {
                  return field.get(obj);
              } catch (final IllegalAccessException e) {
                  if (throwException) {
                      throw new IllegalArgumentException(
                              "Can't read " + (obj == null ? "static " : "") + " field \"" + fieldName + "\": " + e);
                  }
              }
          }
          return null;
      }