public static @Nullable DomInvocationHandler getDomInvocationHandler(DomElement proxy) {
    if (proxy instanceof DomFileElement) {
      return null;
    }
    if (proxy instanceof DomInvocationHandler h) {
      return h;
    }

    InvocationHandler handler = AdvancedProxy.getInvocationHandler(proxy);
    if (handler instanceof StableInvocationHandler) {
      //noinspection unchecked
      DomElement element = ((StableInvocationHandler<DomElement>)handler).getWrappedElement();
      return element == null ? null : getDomInvocationHandler(element);
    }
    else if (handler instanceof DomInvocationHandler) {
      return (DomInvocationHandler)handler;
    }
    else if (handler instanceof DomInvocationHandler.MyInvocationHandler h) {
      return h.getDomInvocationHandler();
    }
    else {
      return null;
    }
  }
public static @Nullable DomInvocationHandler getDomInvocationHandler(DomElement proxy)