docs: public static <K> void validateConfiguredKeyType(Class<K> keyType, K key) throws ClassCastException {
          if (Object.class != keyType) {
              // means that type checks is required
              if (!keyType.isAssignableFrom(key.getClass())) {
                  throw new ClassCastException("Key '" + key + "' is not assignable to " + keyType);
              }
          }
      }