code: private void setStrategy(final ClassRealm realm, final Strategy strategy) {
          assert realm != null;
          assert strategy != null;
  
          try {
              Field field = realm.getClass().getDeclaredField("strategy");
  
              try {
                  field.set(realm, strategy);
              }
              catch (IllegalAccessException ignore) {
                  // try again
                  field.setAccessible(true);
  
                  try {
                      field.set(realm, strategy);
                  }
                  catch (IllegalAccessException e) {
                      throw new IllegalAccessError(e.getMessage());
                  }
              }
          }
          catch (NoSuchFieldException e) {
              throw new Error(e);
          }
      }
docs: There is no public API to set/change a realms strategy, so we use some reflection muck to set the private field.