@Override
  public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
    synchronized (getClassLoadingLock(name)) {
      Class<?> loadedClass = findLoadedClass(name);
      if (loadedClass != null) {
        return loadedClass;
      }
      if (isClosed) {
        throw new ClassNotFoundException("This ClassLoader is closed");
      }
      if (config.shouldAcquire(name)) {
        loadedClass =
            PerfStatsCollector.getInstance()
                .measure("load sandboxed class", () -> maybeInstrumentClass(name));
      } else {
        loadedClass = getParent().loadClass(name);
      }

      if (resolve) {
        resolveClass(loadedClass);
      }

      return loadedClass;
    }
  }
@Test
  public void shouldInterceptFilteredStaticMethodInvocations() throws Exception {
    setClassLoader(
        new SandboxClassLoader(
            configureBuilder()
                .addInterceptedMethod(
                    new MethodRef(AClassToForget.class, "forgettableStaticMethod"))
                .build()));

    Class<?> theClass = loadClass(AClassThatRefersToAForgettableClass.class);
    Object instance = theClass.getDeclaredConstructor().newInstance();
    Object output =
        theClass
            .getMethod("interactWithForgettableStaticMethod")
            .invoke(shadow.directlyOn(instance, (Class<Object>) theClass));
    assertEquals("yess? forget this: null", output);
  }