code: private ClassLoader getDelegationClassLoader(String docletClassName) {
          ClassLoader ctxCL = Thread.currentThread().getContextClassLoader();
          ClassLoader sysCL = ClassLoader.getSystemClassLoader();
          if (sysCL == null)
              return ctxCL;
          if (ctxCL == null)
              return sysCL;
  
          // Condition 1.
          try {
              sysCL.loadClass(docletClassName);
              try {
                  ctxCL.loadClass(docletClassName);
              } catch (ClassNotFoundException e) {
                  return sysCL;
              }
          } catch (ClassNotFoundException e) {
          }
  
          // Condition 2.
          try {
              if (getClass() == sysCL.loadClass(getClass().getName())) {
                  try {
                      if (getClass() != ctxCL.loadClass(getClass().getName()))
                          return sysCL;
                  } catch (ClassNotFoundException e) {
                      return sysCL;
                  }
              }
          } catch (ClassNotFoundException e) {
          }
  
          return ctxCL;
      }
docs: /*
  Returns the delegation class loader to use when creating
  appClassLoader (used to load the doclet).  The context class
  loader is the best choice, but legacy behavior was to use the
  default delegation class loader (aka system class loader).
  
  Here we favor using the context class loader.  To ensure
  compatibility with existing apps, we revert to legacy
  behavior if either or both of the following conditions hold:
  
  1) the doclet is loadable from the system class loader but not
  from the context class loader,
  
  2) this.getClass() is loadable from the system class loader but not
  from the context class loader.