From: rtrimana Date: Fri, 14 Jun 2019 19:01:13 +0000 (-0700) Subject: Preparing for tracking the object creation etc. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=commitdiff_plain;h=983dbabe92639b1ebe21e1af6a43daa2f365f847 Preparing for tracking the object creation etc. --- diff --git a/examples/Reflection.java b/examples/Reflection.java index 4619e4b..4372665 100644 --- a/examples/Reflection.java +++ b/examples/Reflection.java @@ -5,6 +5,7 @@ import java.lang.reflect.TypeVariable; import java.util.List; import java.util.Map; import java.util.ArrayList; +import java.util.Arrays; public class Reflection { @@ -45,20 +46,22 @@ public class Reflection { 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(); - /*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();*/ + /* Type returnType = methods[0].getGenericReturnType(); - System.out.println(returnType); + System.out.println(returnType);*/ } } diff --git a/src/peers/gov/nasa/jpf/vm/JPF_java_lang_Class.java b/src/peers/gov/nasa/jpf/vm/JPF_java_lang_Class.java index 56496a8..06ed5a4 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_java_lang_Class.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_java_lang_Class.java @@ -108,6 +108,15 @@ public class JPF_java_lang_Class extends NativePeer { 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, diff --git a/src/peers/gov/nasa/jpf/vm/JPF_java_lang_reflect_Method.java b/src/peers/gov/nasa/jpf/vm/JPF_java_lang_reflect_Method.java index 2f485e1..4e1987b 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_java_lang_reflect_Method.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_java_lang_reflect_Method.java @@ -115,7 +115,7 @@ public class JPF_java_lang_reflect_Method extends NativePeer { } // 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(); @@ -162,8 +162,8 @@ public class JPF_java_lang_reflect_Method extends NativePeer { 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();