Found a new case with Class<U> as a generic parameter.
authorrtrimana <rtrimana@uci.edu>
Thu, 20 Jun 2019 19:45:56 +0000 (12:45 -0700)
committerrtrimana <rtrimana@uci.edu>
Thu, 20 Jun 2019 19:46:31 +0000 (12:46 -0700)
examples/ClassDemo.java
examples/Empty.groovy
examples/Reflection.java
src/main/gov/nasa/jpf/vm/MethodInfo.java

index e0a5c4df19c9dca588331a5d094cb782690c56d8..0a76996010bba55c2e68ac34b9fd583028969229 100644 (file)
@@ -1,6 +1,7 @@
 import java.lang.*;
 import java.lang.reflect.*;
 import java.util.*;
+import java.math.*;
 
 public class ClassDemo {
 
@@ -10,5 +11,8 @@ public class ClassDemo {
       TypeVariable[] tValue = List.class.getTypeParameters();
       //System.out.println(tValue[0].getName());
          System.out.println(tValue[0]);
+         
+         BigInteger bi = new BigInteger("-1");
+         System.out.println(bi);
    }
-} 
\ No newline at end of file
+} 
index 8d1f87498f2f169193260caa1781cb2e0033b509..93c4cc66e41a20e30ccefa6942fc48b6f676ec5c 100644 (file)
@@ -1,9 +1,28 @@
 class Empty {
 
-       public static void main(String... args) {
-               /*int rand = Math.random()*10
-               int test = 10;
-               double test2 = 0.0;*/
+       // This function runs when the SmartApp is installed
+       def installed() {
+               // This is a standard debug statement in Groovy
+               //log.debug "Installed with settings: ${settings}"
+               int x = 5;
+               int y = 6;
+               int result = x + y;
+               return result;
+               //initialize()
+       }
 
+       // This function is where you initialize callbacks for event listeners
+       //def initialize() {
+               // The subscribe function takes a input, a state, and a callback method
+               //subscribe(contact, "contact.open", openHandler)
+               //subscribe(contact, "contact.closed", closedHandler)
+       //}
+
+       static void main(String[] args) {               
+
+               //Empty emp = new Empty();
+               //int result = emp.installed();
+               println result;
+               //println "Test"
        }       
 }
index f2feb06eaf5491190945dfd566f69f6dc075dcd7..c49ce47fa6d9c6a96667b53d833556517cd744bd 100644 (file)
@@ -16,10 +16,10 @@ public class Reflection {
        
        }
 
-       class SampleClass {
+       class SampleClass<U> {
           private String sampleField;
 
-          public Generic<Integer,String,Double,Short> setSampleField(List<String> listString, Map<Integer,String> mapString,
+          public Generic<Integer,String,Double,Short> setSampleField(Class<U> 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; 
@@ -43,7 +43,7 @@ public class Reflection {
    public static void main(String[] args) {
 
       Method[] methods = SampleClass.class.getMethods();
-      Type[] parameters = methods[0].getGenericParameterTypes();
+      Type[] parameters = methods[3].getGenericParameterTypes();
       //Type[] parameters = methods[0].getGenericParameterTypes();
       for (int i = 0; i < parameters.length; i++) {
          System.out.println(parameters[i]);
index 4b8f9ffa1eb9669b27642e42120c0d8996362d85..7a1d48db1ebd3e56a4d49d7eb251825ae42694a0 100644 (file)
@@ -509,8 +509,6 @@ public class MethodInfo extends InfoObject implements GenericSignatureHolder  {
     // TODO: in the class file.
     if (genericSignature == null || genericSignature.equals("") || genericSignature.contains("<*>"))
       return getArgumentTypeNames();
-    if (!genericSignature.contains(":"))
-      return new String[0];
     return Types.getArgumentTypeNames(genericSignature);
   }
 
@@ -596,8 +594,6 @@ public class MethodInfo extends InfoObject implements GenericSignatureHolder  {
     // TODO: in the class file.
     if (genericSignature == null || genericSignature.equals("") || genericSignature.contains("<*>"))
       return Types.getReturnTypeName(signature);
-    if (!genericSignature.contains(":"))
-      return Types.getReturnTypeName(signature);
     return Types.getGenericReturnTypeName(genericSignature);
   }