From: rtrimana Date: Thu, 20 Jun 2019 19:45:56 +0000 (-0700) Subject: Found a new case with Class as a generic parameter. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=commitdiff_plain;h=2e1ede99e28cc7890562ec5c3b6b14a3ccf5429b Found a new case with Class as a generic parameter. --- diff --git a/examples/ClassDemo.java b/examples/ClassDemo.java index e0a5c4d..0a76996 100644 --- a/examples/ClassDemo.java +++ b/examples/ClassDemo.java @@ -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 +} diff --git a/examples/Empty.groovy b/examples/Empty.groovy index 8d1f874..93c4cc6 100644 --- a/examples/Empty.groovy +++ b/examples/Empty.groovy @@ -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" } } diff --git a/examples/Reflection.java b/examples/Reflection.java index f2feb06..c49ce47 100644 --- a/examples/Reflection.java +++ b/examples/Reflection.java @@ -16,10 +16,10 @@ public class Reflection { } - class SampleClass { + class SampleClass { private String sampleField; - public Generic setSampleField(List listString, Map mapString, + public Generic setSampleField(Class clazz, List listString, Map mapString, Generic 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]); diff --git a/src/main/gov/nasa/jpf/vm/MethodInfo.java b/src/main/gov/nasa/jpf/vm/MethodInfo.java index 4b8f9ff..7a1d48d 100644 --- a/src/main/gov/nasa/jpf/vm/MethodInfo.java +++ b/src/main/gov/nasa/jpf/vm/MethodInfo.java @@ -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); }