MergedClass { public static Constructor<?> getConstructor2(ClassInjector injector, Class<?>[] classes) throws IllegalArgumentException { return getConstructor2(injector, classes, null, null, OBSERVER_DISABLED); } private  MergedClass(); static Constructor<?> getConstructor(ClassInjector injector,
                                                Class<?>[] classes); static Constructor<?> getConstructor(ClassInjector injector,
                                                Class<?>[] classes,
                                                Class<?>[] interfaces); static Constructor<?> getConstructor(ClassInjector injector,
                                                Class<?>[] classes,
                                                String[] prefixes); static Constructor<?> getConstructor(ClassInjector injector,
                                                Class<?>[] classes,
                                                String[] prefixes,
                                                Class<?>[] interfaces); static Constructor<?> getConstructor(ClassInjector injector,
                                                Class<?>[] classes,
                                                String[] prefixes,
                                                int observerMode); static Constructor<?> getConstructor(ClassInjector injector,
                                                Class<?>[] classes,
                                                String[] prefixes,
                                                Class<?>[] interfaces,
                                                int observerMode); static Constructor<?> getConstructor2(ClassInjector injector,
                                                 Class<?>[] classes); static Constructor<?> getConstructor2(ClassInjector injector,
                                                 Class<?>[] classes,
                                                 Class<?>[] interfaces); static Constructor<?> getConstructor2(ClassInjector injector,
                                                 Class<?>[] classes,
                                                 String[] prefixes); static Constructor<?> getConstructor2(ClassInjector injector,
                                                 Class<?>[] classes,
                                                 String[] prefixes,
                                                 Class<?>[] interfaces); static Constructor<?> getConstructor2(ClassInjector injector,
                                                 Class<?>[] classes,
                                                 String[] prefixes,
                                                 int observerMode); static Constructor<?> getConstructor2(ClassInjector injector,
                                                 Class<?>[] classes,
                                                 String[] prefixes,
                                                 Class<?>[] interfaces,
                                                 int observerMode); static ClassFile buildClassFile(String className, Class<?>[] classes); static ClassFile buildClassFile(String className, Class<?>[] classes,
                                           Class<?>[] interfaces); static ClassFile buildClassFile(String className,
                                           Class<?>[] classes, 
                                           String[] prefixes); static ClassFile buildClassFile(String className,
                                           Class<?>[] classes, 
                                           String[] prefixes,
                                           Class<?>[] interfaces); static ClassFile buildClassFile(String className,
                                           Class<?>[] classes, 
                                           String[] prefixes,
                                           int observerMode); static ClassFile buildClassFile(String className,
                                           Class<?>[] classes, 
                                           String[] prefixes,
                                           Class<?>[] interfaces,
                                           int observerMode); static final int OBSERVER_DISABLED; static final int OBSERVER_ENABLED; static final int OBSERVER_ACTIVE; static final int OBSERVER_EXTERNAL; }
@Test public void testGetConstructorWithGenerics() throws Exception { ClassInjector injector = ClassInjector.getInstance(); Constructor<?> ctor1 = MergedClass.getConstructor2 ( injector, new Class[] { PlayContext.class, GameContext.class, StringContext.class }, new String[] { "PlayContext$", "GameContext$", "StringContext$" } ); int found1 = 0, bridge1 = 0; Method[] methods1 = ctor1.getDeclaringClass().getMethods(); for (Method method1 : methods1) { if (method1.getName().equals("getPlay")) { found1++; if (method1.isBridge()) { bridge1++; } } } assertEquals("expected two getPlay methods", 2, found1); assertEquals("expected one getPlay bridge method", 1, bridge1); Constructor<?> ctor2 = MergedClass.getConstructor2 ( ClassInjector.getInstance(), new Class[] { ctor1.getDeclaringClass(), Dog.class } ); int found2 = 0, bridge2 = 0; Method[] methods2 = ctor2.getDeclaringClass().getMethods(); for (Method method2 : methods2) { if (method2.getName().equals("getPlay")) { found2++; if (method2.isBridge()) { bridge2++; } } } assertEquals("expected two getPlay methods", 2, found1); assertEquals("expected one getPlay bridge method", 1, bridge1); Method playsMethod = ctor2.getDeclaringClass().getMethod("getPlays"); Type returnType = playsMethod.getGenericReturnType(); assertTrue("expected param type", returnType instanceof ParameterizedType); assertEquals("expected plays type for type param", HockeyGamePlayLog.class, ((ParameterizedType) returnType).getActualTypeArguments()[0]); }