public static boolean isAssignableFrom ( Class < ? > interfaceClass , Class < ? > implementClass ) { if ( interfaceClass . isAssignableFrom ( implementClass ) ) { return true ; } // 跨ClassLoader的情况 String interfaceName = interfaceClass . getCanonicalName ( ) ; return implementClass . getCanonicalName ( ) . equals ( interfaceName ) || isImplementOrSubclass ( interfaceName , implementClass ) ; }
The isAssignableFrom method which can cross multiple classloader .