Adding ParameterizedTypeImpl to the getGenericInterfaces method.
[jpf-core.git] / examples / Reflection.java
index d8f6e44a742d498236b5627405e938167caab8cc..21fdd5763aad5b00d8b15b8672de93fb746237eb 100644 (file)
@@ -1,6 +1,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
+import java.io.Serializable;
 
 import java.util.List;
 import java.util.Map;
@@ -9,22 +10,26 @@ import java.util.Arrays;
 
 public class Reflection {
 
-       class GenericShort<TUVW,ABCD> {
-       }
+    interface GenericSuperShort<XYZ> {
 
-       class Generic<TUVW,ABCD,KLM,NOP> extends GenericShort<TUVW,ABCD> {
-       
-       }
+    }
 
-       class SampleClass<VWXZ> {
-          private String sampleField;
+    class GenericShort<TUVW,ABCD> {
+    }
 
-          public Generic<Integer,String,Double,Short> setSampleField(Class<VWXZ> clazz, List<String> listString, Map<Integer,String> mapString,
-                               Generic<Integer,String,Double,Short> test,
-                               String sampleField, int one, short two, double three, Object obj) {
-                 this.sampleField = sampleField; 
-                 return test;
-          }
+    class Generic<TUVW,ABCD,KLM,NOP,XYZ> extends GenericShort<TUVW,ABCD> implements GenericSuperShort<XYZ>, Serializable {
+
+    }
+
+    class SampleClass<VWXZ> {
+        private String sampleField;
+
+        public Generic<Integer,String,Double,Short,Float> setSampleField(Class<VWXZ> clazz, List<String> listString, Map<Integer,String> mapString,
+                                                                         Generic<Integer,String,Double,Short,Float> test,
+                                                                         String sampleField, int one, short two, double three, Object obj) {
+            this.sampleField = sampleField;
+            return test;
+        }
           
           
           /*public String getSampleField() {
@@ -59,6 +64,11 @@ public class Reflection {
       Type superCls = Generic.class.getGenericSuperclass();
       //Type superCls = String.class.getGenericSuperclass();
       System.out.println(superCls);
+        System.out.println();
+        Type[] interfaces = Generic.class.getGenericInterfaces();
+        for (int i = 0; i < interfaces.length; i++) {
+            System.out.println(interfaces[i]);
+        }
       /*Class[] parameterTypes = methods[0].getParameterTypes();
       for(Class parameterType: parameterTypes){
          System.out.println(parameterType.getName());