/** * Loads a class file by a given class loader. * * @param neighbor a class belonging to the same package that * the loaded class belongs to. * It can be null. * @param loader The class loader. It can be null if {@code neighbor} * is not null. * @param domain if it is null, a default domain is used. * @since 3.3 */ public static Class<?> toClass(ClassFile cf, Class<?> neighbor, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException { try { byte[] b = toBytecode(cf); if (ProxyFactory.onlyPublicMethods) return DefineClassHelper.toPublicClass(cf.getName(), b); else return DefineClassHelper.toClass(cf.getName(), neighbor, loader, domain, b); } catch (IOException e) { throw new CannotCompileException(e); } }