code: @SuppressWarnings("unchecked")
      public GroovyObject instantiateDelegateWithBaseClass(Map closureMap, List<Class> interfaces, Object delegate, Class baseClass, String name) {
          Map<Object,Object> map = closureMap!=null?closureMap: EMPTY_CLOSURE_MAP;
          Class[] intfs = interfaces!=null? interfaces.toArray(new Class[interfaces.size()]): EMPTY_INTERFACE_ARRAY;
          Class base = baseClass;
          if (base==null) {
              if (intfs.length>0) {
                  base=intfs[0];
              } else {
                  base = Object.class;
              }
          }
          Set<String> keys = map==EMPTY_CLOSURE_MAP?EMPTY_KEYSET:new HashSet<String>();
          for (Object o : map.keySet()) {
              keys.add(o.toString());
          }
          CacheKey key = new CacheKey(base, delegate.getClass(), keys, intfs, emptyMethods, true);
          ProxyGeneratorAdapter adapter = (ProxyGeneratorAdapter) adapterCache.get(key);
          if (adapter==null) {
              adapter = new ProxyGeneratorAdapter(map, base, intfs, delegate.getClass().getClassLoader(), emptyMethods, delegate.getClass());
              adapterCache.put(key, adapter);
          }
          return adapter.delegatingProxy(delegate, map, (Object[])null);
      }
docs: Creates a proxy with a delegate object.
  
  @param closureMap the closure for methods not handled by the delegate
  @param interfaces interfaces to be implemented
  @param delegate the delegate object
  @param baseClass the base class
  @param name the name of the proxy, unused, but kept for compatibility with previous versions of Groovy.
  @return a proxy object implementing the specified interfaces, and delegating to the provided object