try { Class clazz = new KeyFactoryGenerator(getNextName(keyInterface.getPackage()), keyInterface, loader).define(); return (KeyFactory)clazz.getConstructor(new Class[]{}).newInstance(new Object[]{}); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new CodeGenerationException(e); }
Class result = new KeyFactoryGenerator(getNextName(keyInterface.getPackage()), keyInterface, loader).define(); return (KeyFactory)FactoryCache.newInstance(result, Constants.TYPES_EMPTY, null);
    public static KeyFactory makeFactory(Class keyInterface, ClassLoader loader) {        // TODO: caching?        if (loader == null) {            loader = defaultLoader;        }        try {            Class clazz = new KeyFactoryGenerator(getNextName(keyInterface.getPackage()),                                                  keyInterface,                                                  loader).define();            return (KeyFactory)clazz.getConstructor(new Class[]{}).newInstance(new Object[]{});        } catch (RuntimeException e) {            throw e;        } catch (Exception e) {            throw new CodeGenerationException(e);        }    }