CSR :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
As demonstrated by the program below, java.lang.reflect.Method.toGenericString doesn't print bounds on type variables on generic methods. Run the program like this: $ java Test java.util.Collections max java.util.Collection java.util.Collections max java.util.Collection public static <T> T java.util.Collections.max(java.util.Collection<? extends T>) The output should have been: max java.util.Collection public static <T extends Object & Comparable<? super T>> T java.util.Collections.max(java.util.Collection<? extends T>) import java.lang.reflect.*; public class Test { public static void main(String... args) throws ClassNotFoundException, NoSuchMethodException { for (int i=0; i<args.length; i++) System.out.println(args[i]); String cName = args[0]; String mName = args[1]; Class<?> c = Class.forName(cName); Class<?>[] cs = new Class<?>[args.length - 2]; for (int i=0; i<args.length-2; i++) cs[i] = Class.forName(args[i+2]); Method m = c.getMethod(mName, cs); System.out.println(m.toGenericString()); } }
|