public static Field getModifiersField() throws IllegalAccessException, NoSuchFieldException {
    // this is copied from https://github.com/powermock/powermock/pull/1010/files to work around
    // JDK 12+
    Field modifiersField = null;
    try {
      modifiersField = Field.class.getDeclaredField("modifiers");
    } catch (NoSuchFieldException e) {
      try {
        Method getDeclaredFields0 =
          Class.class.getDeclaredMethod("getDeclaredFields0", boolean.class);
        boolean accessibleBeforeSet = getDeclaredFields0.isAccessible();
        getDeclaredFields0.setAccessible(true);
        Field[] fields = (Field[]) getDeclaredFields0.invoke(Field.class, false);
        getDeclaredFields0.setAccessible(accessibleBeforeSet);
        for (Field field : fields) {
          if ("modifiers".equals(field.getName())) {
            modifiersField = field;
            break;
          }
        }
        if (modifiersField == null) {
          throw e;
        }
      } catch (NoSuchMethodException ex) {
        e.addSuppressed(ex);
        throw e;
      } catch (InvocationTargetException ex) {
        e.addSuppressed(ex);
        throw e;
      }
    }
    return modifiersField;
  }
Get and invoke the target method from the given object with given parameters
@param obj        the object to get and invoke method from
@param methodName the name of the method to invoke
@param params     the parameters for the method to invoke
@return the return value of the method invocation
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java