(advices != null ? (Advice[]) advices.toArray(new Advice[advices.size()]) : new Advice[0]));
}
public static Object createProxy(Class[] classes, Object target, ClassLoader classLoader,
BundleContext bundleContext, Advice[] advices) {
ProxyFactory factory = new ProxyFactory();
ClassUtils.configureFactoryForClass(factory, classes);
for (int i = 0; i < advices.length; i++) {
factory.addAdvice(advices[i]);
}
if (target != null)
factory.setTarget(target);
// no need to add optimize since it means implicit usage of CGLib always
// which is determined automatically anyway
// factory.setOptimize(true);
factory.setFrozen(true);
factory.setOpaque(true);
try {
return factory.getProxy(classLoader);
}
catch (NoClassDefFoundError ncdfe) {
DebugUtils.debugClassLoadingThrowable(ncdfe, bundleContext.getBundle(), classes);
throw ncdfe;
}