Fixing getGenericReturnType to recognize the GenericArrayTypeImpl and ParameterizedTy...
[jpf-core.git] / examples / Reflection.java
index 568743683d21f3a328d748972ebcaacaa1fbc603..b32715832912b6b30b60dc1e25510a89f5c6cb26 100644 (file)
@@ -24,7 +24,8 @@ public class Reflection {
     class SampleClass<VWXZ> {
         private String sampleField;
 
-        public Class<?> setSampleField(Class<?> clazz, 
+        public Class<?> setSampleField(Class<?> clazz,
+                       Class<? extends List> list, Class<? super Map> map,
                        List<String> listString, Map<Integer,String> mapString, 
                        Generic<Integer,String,Double,Short,Float> test, 
                        String sampleField, int one, short two, double three, Object obj) {
@@ -72,13 +73,15 @@ public class Reflection {
             System.out.println(interfaces[i]);
         }*/
       
-      Method[] methods = SampleClass.class.getMethods();
-        Method method = null;
-        for(Method mth : methods) {
-            if (mth.getName().equals("setSampleField")) {
-                method = mth;
-            }
+         Method[] methods = Class.class.getMethods();
+         Method method = null;
+      for(Method mth : methods) {
+        //if (mth.getName().equals("getConstructor")) {
+        //if (mth.getName().equals("isAssignableFrom")) {
+        if (mth.getName().equals("getTypeParameters")) {
+           method = mth;
         }
+      }
       Type[] parameters = method.getGenericParameterTypes();
       //Type[] parameters = methods[0].getGenericParameterTypes();
       for (int i = 0; i < parameters.length; i++) {