Adding tests for Type parameter, wild card, and class types for generic classes.
[jpf-core.git] / examples / Reflection.java
index b32715832912b6b30b60dc1e25510a89f5c6cb26..788ef585547341268ab7aee8a4bafa5df9a03d9c 100644 (file)
@@ -63,7 +63,10 @@ public class Reflection {
       for (int i = 0; i < parameters.length; i++) {
          System.out.println(parameters[i]);
       }
-      System.out.println();*/
+      System.out.println();
+      Type returnType = method.getGenericReturnType();
+      System.out.println(returnType);*/
+      
       /*Type superCls = Generic.class.getGenericSuperclass();
       //Type superCls = String.class.getGenericSuperclass();
       System.out.println(superCls);
@@ -73,12 +76,13 @@ public class Reflection {
             System.out.println(interfaces[i]);
         }*/
       
+      
          Method[] methods = Class.class.getMethods();
          Method method = null;
       for(Method mth : methods) {
-        //if (mth.getName().equals("getConstructor")) {
+        if (mth.getName().equals("getConstructor")) {
         //if (mth.getName().equals("isAssignableFrom")) {
-        if (mth.getName().equals("getTypeParameters")) {
+        //if (mth.getName().equals("getSuperclass")) {
            method = mth;
         }
       }
@@ -88,6 +92,10 @@ public class Reflection {
          System.out.println(parameters[i]);
       }
       System.out.println();
+      Type returnType = method.getGenericReturnType();
+      System.out.println(returnType);
+         
+
       /*Class[] parameterTypes = methods[0].getParameterTypes();
       for(Class parameterType: parameterTypes){
          System.out.println(parameterType.getName());   
@@ -107,9 +115,7 @@ public class Reflection {
           System.out.println(bound);
       }
       System.out.println();*/
-      Type returnType = method.getGenericReturnType();
-      System.out.println(returnType);
-         
+  
    }
 }