protected Class<?> findClass(String name, boolean followImports) throws ClassNotFoundException { try { // try to find it within this module first. // this potentially causes a problem when two modules have the same jar in the classpath, // but because the classes are most often found locally, this has a tremendous performance boost. // so we knowingly make this decision to do child-first loading. // the pain of duplicate jars are somewhat mitigated by the fact that dependencies tend to be // defined between HK2 modules, and those will not show up in the classpath of this module. return findClassDirect(name); } catch(ClassNotFoundException cfne) { if (followImports) { Class c=null; for (ClassLoaderFacade classLoader : facadeSurrogates) { try { c = classLoader.getClass(name); } catch(ClassNotFoundException e) { // ignored. } if (c!=null) { return c; } } for (ClassLoader classLoader : surrogates) { try { c = classLoader.loadClass(name); } catch(ClassNotFoundException e) { // ignored. } if (c!=null) {
protected Class<?> loadClass(String name, boolean resolve, boolean followImports) throws ClassNotFoundException { // First, check if the class has already been loaded Class c = findLoadedClass(name); if (c == null) { try { if (getParent() != null) { c = getParent().loadClass(name); } } catch (ClassNotFoundException e) { } if (c == null) { c = findClass(name, followImports); } if (resolve) { resolveClass(c); } } else { if (c.getClassLoader() == this) { return c; } else throw new ClassNotFoundException(name); } return c; }
protected Class<?> findClass(String name, boolean followImports) throws ClassNotFoundException { try { // try to find it within this module first. // this potentially causes a problem when two modules have the same jar in the classpath, // but because the classes are most often found locally, this has a tremendous performance boost. // so we knowingly make this decision to do child-first loading. // the pain of duplicate jars are somewhat mitigated by the fact that dependencies tend to be // defined between HK2 modules, and those will not show up in the classpath of this module. return findClassDirect(name); } catch(ClassNotFoundException cfne) { if (followImports) { Class c=null; for (ClassLoaderFacade classLoader : facadeSurrogates) { try { c = classLoader.getClass(name); } catch(ClassNotFoundException e) { // ignored. } if (c!=null) { return c; } } for (ClassLoader classLoader : surrogates) { try { c = classLoader.loadClass(name); } catch(ClassNotFoundException e) { // ignored. } if (c!=null) {
protected Class<?> loadClass(String name, boolean resolve, boolean followImports) throws ClassNotFoundException { // First, check if the class has already been loaded Class c = findLoadedClass(name); if (c == null) { try { if (getParent() != null) { c = getParent().loadClass(name); } } catch (ClassNotFoundException e) { } if (c == null) { c = findClass(name, followImports); } if (resolve) { resolveClass(c); } } else { if (c.getClassLoader() == this) { return c; } else throw new ClassNotFoundException(name); } return c; }
protected Class<?> findClass(String name) throws ClassNotFoundException { try { return super.findClass(name); } catch (ClassNotFoundException e) { // punch in. find the provider class, no matter where we are. ModuleImpl m = module.getRegistry().getProvidingModule(name); if(m!=null) return m.getPrivateClassLoader().loadClass(name); throw e; } }
protected Class<?> findClass(String name) throws ClassNotFoundException { try { return super.findClass(name); } catch (ClassNotFoundException e) { // punch in. find the provider class, no matter where we are. ModuleImpl m = module.getRegistry().getProvidingModule(name); if(m!=null) return m.getPrivateClassLoader().loadClass(name); throw e; } }