/** * Computes the target classloader to place the proxy in based on the used dependencies. * * @throws InvalidProxyDescriptionException * if no fitting classloader can be located */ private void computeTargetClassLoader() throws InvalidProxyDescriptionException { // Collect all dependencies of the proxy class HashSet<ClassLoader> dependencies = new HashSet<ClassLoader>(); dependencies.add(getSuperClass().getClassLoader()); for (Class<?> interf : getImplementedInterfaces()) { dependencies.add(interf.getClassLoader()); } for (MethodBuildPlanImpl meth : getMethods()) { dependencies.add(meth.getReturnType().getClassLoader()); for (Class<?> type : meth.getParameterTypes()) { dependencies.add(type.getClassLoader()); } } targetClassLoader = getLowestClassLoader(dependencies); }