docs: @SuppressWarnings("unchecked")
    public static CodecInfo getCodecInfoFromTerms(Terms t) throws IOException {
      try {
        HashMap<String, IndexInput> indexInputList = null;
        HashMap<String, Long> indexInputOffsetList = null;
        Object version = null;
        Method[] methods = t.getClass().getMethods();
        Object[] emptyArgs = null;
        for (Method m : methods) {
          if (m.getName().equals("getIndexInputList")) {
            indexInputList = (HashMap<String, IndexInput>) m.invoke(t, emptyArgs);
          } else if (m.getName().equals("getIndexInputOffsetList")) {
            indexInputOffsetList = (HashMap<String, Long>) m.invoke(t, emptyArgs);
          } else if (m.getName().equals("getVersion")) {
            version = m.invoke(t, emptyArgs);
          }
        }
        if (indexInputList == null || indexInputOffsetList == null
            || version == null) {
          throw new IOException("Reader doesn't provide MtasFieldsProducer");
        } else {
          return new CodecInfo(indexInputList, indexInputOffsetList,
              (int) version);
        }
      } catch (IllegalAccessException | InvocationTargetException e) {
        throw new IOException("Can't get codecInfo", e);
      }
    }