@ Override protected Class < ? > resolveProxyClass ( String [ ] interfaceNames ) throws ClassNotFoundException { ClassLoader proxyClassLoader = classLoader ; Class < ? > [ ] interfaces = new Class [ interfaceNames . length ] ; Class < ? > nonPublicInterface = null ; for ( int i = 0 ; i < interfaceNames . length ; i ++ ) { Class < ? > intf = loadClass ( interfaceNames [ i ] ) ; if ( ! Modifier . isPublic ( intf . getModifiers ( ) ) ) { ClassLoader classLoader = getClassLoader ( intf ) ; if ( nonPublicInterface != null ) { if ( classLoader != proxyClassLoader ) { throw new IllegalAccessError ( nonPublicInterface + " and " + intf + " both declared non-public in different class loaders" ) ; } } else { nonPublicInterface = intf ; proxyClassLoader = classLoader ; } } interfaces [ i ] = intf ; } try { return Proxy . getProxyClass ( proxyClassLoader , interfaces ) ; } catch ( IllegalArgumentException ex ) { throw new ClassNotFoundException ( null , ex ) ; } }
Delegates class loading to the specified class loader .