private static boolean requiresClassLoaderDelegate() {
    if (System.getProperty(OSGI_SYSTEM_PROPERTY) != null) {
      CallStack callStack = new CallStack();
      for (Class<?> klass : callStack.getCallingClasses()) {
        ClassLoader classLoader = klass.getClassLoader();
        if (classLoader != null && klass.getClassLoader().getClass().getName().startsWith(ECLIPSE_PACKAGE_PREFIX)) {
          return true;
        }
      }
    }
    return false;
  }
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