code: private static String which(Class clazz) {
          try {
              String classnameAsResource = clazz.getName().replace('.', '/') + ".class";
  
              ClassLoader loader = clazz.getClassLoader();
  
              URL it;
  
              if (loader != null) {
                  it = loader.getResource(classnameAsResource);
              } else {
                  it = ClassLoader.getSystemResource(classnameAsResource);
              }
  
              if (it != null) {
                  return it.toString();
              }
          }
          // The VM ran out of memory or there was some other serious problem. Re-throw.
          catch (VirtualMachineError vme) {
              throw vme;
          }
          // ThreadDeath should always be re-thrown
          catch (ThreadDeath td) {
              throw td;
          }
          catch (Throwable t) {
              // work defensively.
              if (debug) {
                  t.printStackTrace();
              }
          }
          return "unknown location";
      }
docs: Returns the location where the given Class is loaded from.