Fixing a bug: getWildcardTypeImplObject could not recognize variations of class Type...
[jpf-core.git] / examples / Reflection.java
index 788ef585547341268ab7aee8a4bafa5df9a03d9c..d5041d2b238817afa5d786a831ffc706748d05dd 100644 (file)
@@ -25,7 +25,7 @@ public class Reflection {
         private String sampleField;
 
         public Class<?> setSampleField(Class<?> clazz,
-                       Class<? extends List> list, Class<? super Map> map,
+                       Class<? extends List> list, Class<? super Map> map, Class<?> clazz2, Class<VWXZ> clazz3,
                        List<String> listString, Map<Integer,String> mapString, 
                        Generic<Integer,String,Double,Short,Float> test, 
                        String sampleField, int one, short two, double three, Object obj) {
@@ -50,7 +50,7 @@ public class Reflection {
 
    public static void main(String[] args) {
 
-      /*Method[] methods = SampleClass.class.getMethods();
+      Method[] methods = SampleClass.class.getMethods();
       //  Method[] methods = Class.class.getMethods();
         Method method = null;
         for(Method meth : methods) {
@@ -65,7 +65,7 @@ public class Reflection {
       }
       System.out.println();
       Type returnType = method.getGenericReturnType();
-      System.out.println(returnType);*/
+      System.out.println(returnType);
       
       /*Type superCls = Generic.class.getGenericSuperclass();
       //Type superCls = String.class.getGenericSuperclass();
@@ -77,7 +77,7 @@ public class Reflection {
         }*/
       
       
-         Method[] methods = Class.class.getMethods();
+         /*Method[] methods = Class.class.getMethods();
          Method method = null;
       for(Method mth : methods) {
         if (mth.getName().equals("getConstructor")) {
@@ -93,8 +93,21 @@ public class Reflection {
       }
       System.out.println();
       Type returnType = method.getGenericReturnType();
-      System.out.println(returnType);
-         
+      System.out.println(returnType);*/
+      
+      /* TODO: Enumerate all methods in Class.class
+      Method[] methods = Class.class.getMethods();
+      for(Method mth : methods) {
+                 System.out.println("===========================");
+         System.out.println("Method: " + mth.getName());
+                 Type[] parameters = mth.getGenericParameterTypes();
+                 for (int i = 0; i < parameters.length; i++) {
+                    System.out.println(parameters[i]);
+                 }
+                 System.out.println();
+                 Type returnType = mth.getGenericReturnType();
+                 System.out.println(returnType + "\n");
+      }*/
 
       /*Class[] parameterTypes = methods[0].getParameterTypes();
       for(Class parameterType: parameterTypes){