private static Processor createClassLoaderDelegate() {
    try {
      if (cachedProxyClassLoader == null) {
        CallStack callStack = new CallStack();
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        for (Class<?> klass : callStack.getCallingClasses()) {
          if (klass.getClassLoader() != null && klass.getClassLoader().getClass().getName().startsWith(ECLIPSE_PACKAGE_PREFIX)) {
            loader = klass.getClassLoader();
            break;
          }
        }
        cachedProxyClassLoader = new ProxyClassLoader(
            ((URLClassLoader) ProxyProcessor.class.getClassLoader()).getURLs(),
            loader);
      }
      return (Processor) cachedProxyClassLoader.loadClass(DELEGATE_CLASS).newInstance();
    } catch (RuntimeException | Error ex) {
      throw ex;
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
  }
We find the delegating classloader by traversing the call stack and looking for the first
class that has a classloader from the Eclipse namespace. This is bound to be the bundle classloader
of a JDT bundle which can load the required Eclipse compiler types.

NOTE: We cannot simply use the thread context class loader. This works in the Eclipse IDE
(where it is set to ContextFinder), but not in the JDT Language Server.
value-processor/src/org/immutables/processor/ProxyProcessor.java