Fixing the method getGenericParameterTypes to include parameterized object such as...
[jpf-core.git] / examples / Reflection.java
index f2bff8ab62ba9ce019cf132914e3b556448aad14..538bcd1dc3aa54f1ac3c8ab453bf0ae2c816fb29 100644 (file)
@@ -43,7 +43,14 @@ public class Reflection {
    public static void main(String[] args) {
 
       Method[] methods = SampleClass.class.getMethods();
-      Type[] parameters = methods[3].getGenericParameterTypes();
+      //  Method[] methods = Class.class.getMethods();
+        Method method = null;
+        for(Method meth : methods) {
+            if (meth.getName().equals("setSampleField")) {
+                method = meth;
+            }
+        }
+        Type[] parameters = method.getGenericParameterTypes();
       //Type[] parameters = methods[0].getGenericParameterTypes();
       for (int i = 0; i < parameters.length; i++) {
          System.out.println(parameters[i]);
@@ -55,7 +62,7 @@ public class Reflection {
  
       }
       System.out.println();*/
-      TypeVariable[] typeParameters = Generic.class.getTypeParameters();
+      /*TypeVariable[] typeParameters = Generic.class.getTypeParameters();
       //TypeVariable[] typeParameters = SampleClass.class.getTypeParameters();
       for(TypeVariable typeVar: typeParameters){
          System.out.println(typeVar);   
@@ -70,7 +77,7 @@ public class Reflection {
       System.out.println();
       Type returnType = methods[0].getGenericReturnType();
       System.out.println(returnType);
-         
+         */
    }
 }