code: private static void initFactory() {
      if (jsonFactory == null) {
        try {
          // We use reflection because the server side should not
          // depend on gwt-servlet nor gwt-dev. Hence if GWT is not
          // in our classpath means that we are in server side, otherwise
          // we use GWT to figure out if we are running devmode.
          // This is run once, so no performance issues to worry about.
          Class.forName("com.google.gwt.core.shared.GWTBridge");
          Class<?> gwt = Class.forName("com.google.gwt.core.shared.GWT");
          Method method = gwt.getMethod("isClient");
          Object ret = method.invoke(null);
          if (ret instanceof Boolean && ((Boolean) ret)) {
            // We are running DevMode, so create Js versions of the factories
            method = gwt.getMethod("create", Class.class);
            ret = method.invoke(null,
                new Object[] {JsonFactory.class});
            jsonFactory = (JsonFactory) ret;
            ajaxTransport = new AjaxTransportJs();
            return;
          }
        } catch (ClassNotFoundException ignore) {
        } catch (NoSuchMethodException ignore) {
        } catch (SecurityException ignore) {
        } catch (IllegalAccessException ignore) {
        } catch (IllegalArgumentException ignore) {
        } catch (InvocationTargetException ignore) {
        }
        // We are running in the JVM, so create Jre versions.
        jsonFactory = new JsonFactoryJre();
        ajaxTransport = new AjaxTransportJre();
      }
    }
docs: /*
  Create the appropriate version of factories depending
  if whether we are running dev-mode