docs: @Trivial
      @Override
      public Object invoke(Object o, Method m, Object[] params) throws Throwable {
  
          Class<?> declaringClass = m.getDeclaringClass();
          if (Client.class == declaringClass || InvocationHandlerAware.class == declaringClass
              || Object.class == declaringClass) {
              return m.invoke(this, params);
          }
          resetResponse();
          OperationResourceInfo ori = cri.getMethodDispatcher().getOperationResourceInfo(m);
          if (ori == null) {
              reportInvalidResourceMethod(m, "INVALID_RESOURCE_METHOD");
          }
  
          MultivaluedMap<ParameterType, Parameter> types = getParametersInfo(m, params, ori);
          List<Parameter> beanParamsList = getParameters(types, ParameterType.BEAN);
  
          int bodyIndex = getBodyIndex(types, ori);
  
          List<Object> pathParams = getPathParamValues(m, params, types, beanParamsList, ori, bodyIndex);
  
          UriBuilder builder = getCurrentBuilder().clone();
          if (isRoot) {
              addNonEmptyPath(builder, ori.getClassResourceInfo().getURITemplate().getValue());
          }
          addNonEmptyPath(builder, ori.getURITemplate().getValue());
  
          handleMatrixes(m, params, types, beanParamsList, builder);
          handleQueries(m, params, types, beanParamsList, builder);
  
          URI uri = builder.buildFromEncoded(pathParams.toArray()).normalize();
  
          MultivaluedMap<String, String> headers = getHeaders();
          MultivaluedMap<String, String> paramHeaders = new MetadataMap<String, String>();
          handleHeaders(m, params, paramHeaders, beanParamsList, types);
          handleCookies(m, params, paramHeaders, beanParamsList, types);
  
          if (ori.isSubResourceLocator()) {
              ClassResourceInfo subCri = cri.getSubResource(m.getReturnType(), m.getReturnType());
              if (subCri == null) {
                  reportInvalidResourceMethod(m, "INVALID_SUBRESOURCE");
              }
  
              MultivaluedMap<String, String> subHeaders = paramHeaders;
              if (inheritHeaders) {
                  subHeaders.putAll(headers);
              }
  
              ClientState newState = getState().newState(uri, subHeaders,
                                                         getTemplateParametersMap(ori.getURITemplate(), pathParams));
              ClientProxyImpl proxyImpl = new ClientProxyImpl(newState, proxyLoader, subCri, false, inheritHeaders);
              proxyImpl.setConfiguration(getConfiguration());
              return JAXRSClientFactory.createProxy(m.getReturnType(), proxyLoader, proxyImpl);
          }
          headers.putAll(paramHeaders);
  
          getState().setTemplates(getTemplateParametersMap(ori.getURITemplate(), pathParams));
  
          Object body = null;
          if (bodyIndex != -1) {
              body = params[bodyIndex];
              if (body == null) {
                  bodyIndex = -1;
              }
          } else if (types.containsKey(ParameterType.FORM)) {
              body = handleForm(m, params, types, beanParamsList);
          } else if (types.containsKey(ParameterType.REQUEST_BODY)) {
              body = handleMultipart(types, ori, params);
          }
  
          setRequestHeaders(headers, ori, types.containsKey(ParameterType.FORM),
                            body == null ? null : body.getClass(), m.getReturnType());
  
          try {
              return doChainedInvocation(uri, headers, ori, params, body, bodyIndex, null, null);
          } finally {
              resetResponseStateImmediatelyIfNeeded();
          }
  
      }