Preparing for tracking the object creation etc.
authorrtrimana <rtrimana@uci.edu>
Fri, 14 Jun 2019 19:01:13 +0000 (12:01 -0700)
committerrtrimana <rtrimana@uci.edu>
Fri, 14 Jun 2019 19:01:13 +0000 (12:01 -0700)
examples/Reflection.java
src/peers/gov/nasa/jpf/vm/JPF_java_lang_Class.java
src/peers/gov/nasa/jpf/vm/JPF_java_lang_reflect_Method.java

index 4619e4b11b0db1c4c6210b1daa757633b7d7bbf2..43726651bee892061bdd44e85175b59a69b62e71 100644 (file)
@@ -5,6 +5,7 @@ import java.lang.reflect.TypeVariable;
 import java.util.List;
 import java.util.Map;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 public class Reflection {
 
 
 public class Reflection {
 
@@ -45,20 +46,22 @@ public class Reflection {
          System.out.println(parameters[i]);
       }
       System.out.println();
          System.out.println(parameters[i]);
       }
       System.out.println();
-      Class[] parameterTypes = methods[0].getParameterTypes();
+      /*Class[] parameterTypes = methods[0].getParameterTypes();
       for(Class parameterType: parameterTypes){
          System.out.println(parameterType.getName());   
  
       }
       System.out.println();
       for(Class parameterType: parameterTypes){
          System.out.println(parameterType.getName());   
  
       }
       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);   
  
       }
       System.out.println();*/
       for(TypeVariable typeVar: typeParameters){
          System.out.println(typeVar);   
  
       }
       System.out.println();*/
+      /*
       Type returnType = methods[0].getGenericReturnType();
       Type returnType = methods[0].getGenericReturnType();
-      System.out.println(returnType);
+      System.out.println(returnType);*/
    }
 }
 
    }
 }
 
index 56496a88c377dd07c75121382737dcbb2b0a92e3..06ed5a4b0ead57ab128bb9412dcbbc1327371d8e 100644 (file)
@@ -108,6 +108,15 @@ public class JPF_java_lang_Class extends NativePeer {
       return MJIEnv.NULL;
     }
   }
       return MJIEnv.NULL;
     }
   }
+
+  // TODO: Fix for Groovy's model-checking
+  @MJI
+  public int getTypeParameters_____3Ljava_lang_reflect_TypeVariable_2 (MJIEnv env, int robj){
+    ClassInfo ci = env.getReferredClassInfo( robj);
+    AnnotationInfo[] ai = ci.getAnnotations();
+
+    return 1;
+  }
   
   @MJI
   public int getAnnotation__Ljava_lang_Class_2__Ljava_lang_annotation_Annotation_2 (MJIEnv env, int robj,
   
   @MJI
   public int getAnnotation__Ljava_lang_Class_2__Ljava_lang_annotation_Annotation_2 (MJIEnv env, int robj,
index 2f485e1973b57490c6a32b4685ebbc140013364c..4e1987be755d85a5e84ad57f9fc61565f99e39af 100644 (file)
@@ -115,7 +115,7 @@ public class JPF_java_lang_reflect_Method extends NativePeer {
   }
 
   // TODO: Fix for Groovy's model-checking
   }
 
   // TODO: Fix for Groovy's model-checking
-  // TODO: We haven't been able to show the parameterized types
+  // TODO: We have been able to only register the generic class and not yet the parameterized types
   static int getGenericParameterTypes( MJIEnv env, MethodInfo mi) {
     ThreadInfo ti = env.getThreadInfo();
     String[] argTypeNames = mi.getArgumentGenericTypeNames();
   static int getGenericParameterTypes( MJIEnv env, MethodInfo mi) {
     ThreadInfo ti = env.getThreadInfo();
     String[] argTypeNames = mi.getArgumentGenericTypeNames();
@@ -162,8 +162,8 @@ public class JPF_java_lang_reflect_Method extends NativePeer {
     return ci.getClassObjectRef();
   }
   // TODO: Fix for Groovy's model-checking
     return ci.getClassObjectRef();
   }
   // TODO: Fix for Groovy's model-checking
-  // TODO: We haven't been able to show the parameterized types
-  
+  // TODO: We have been able to only register the generic class and not yet the parameterized types
+
   int getExceptionTypes(MJIEnv env, MethodInfo mi) {
     ThreadInfo ti = env.getThreadInfo();
     String[] exceptionNames = mi.getThrownExceptionClassNames();
   int getExceptionTypes(MJIEnv env, MethodInfo mi) {
     ThreadInfo ti = env.getThreadInfo();
     String[] exceptionNames = mi.getThrownExceptionClassNames();