Class uninitializedClass = Class.forName(externalName, false, loader); if (iface.isAssignableFrom(uninitializedClass) ) { Class<T> type = iface.getClass().cast( Class.forName(externalName) ); impls.add(type);
Class type = loader.loadClass(externalName); if (iface.isAssignableFrom(type) ) { impls.add( (Class<T>) type);
    static <T> void addIfImplements(Set<Class<T>> impls, Class<T> iface, String name) {        try {            log.trace("Checking to see if class '", name, "' implements ", iface.getName());            ClassLoader loader = Thread.currentThread().getContextClassLoader();            String externalName = name.substring(0, name.indexOf('.')).replace('/', '.');            Class uninitializedClass = Class.forName(externalName, false, loader);            if (iface.isAssignableFrom(uninitializedClass) ) {                Class<T> type = iface.getClass().cast( Class.forName(externalName) );                impls.add(type);            }        }        catch (Throwable t) {            log.warn(t, "Could not examine class '", name, "'");        }    }