//check that classes are valid
for (Class<?> clz : classes) {
try {
final Class<?> loaded = Class.forName(clz.getName(), false, classLoader);
if (loaded != clz) {
throw new InvalidStateException("Class entry '" + clz.getName() + "'"
+ " contributed from module '" + reference.getContributingModule() + "'"
+ " with bean name '" + reference.getBeanName() + "'"
+ " is incompatible with class loader " + classLoader);
}
} catch (ClassNotFoundException e) {
throw new InvalidStateException("Class entry '" + clz.getName() + "'"
+ " contributed from module '" + reference.getContributingModule() + "'"
+ " with bean name '" + reference.getBeanName() + "'"
+ " could not be found using class loader " + classLoader);
}
}