Fixing a bug: Map's parameterized type signature with wildcard was not handled properly.
[jpf-core.git] / src / main / gov / nasa / jpf / vm / Types.java
index ba71512..981ac10 100644 (file)
@@ -1222,20 +1222,30 @@ public class Types {
     int pos = signature.indexOf('<', 0);
     if (pos == -1)
       return new String[0];
+
+    pos = pos + 1;
     ArrayList<String> typeVarNames = new ArrayList<>();
 
     while (pos < signature.length()) {
       String typeVarName = "";
+      // Try comma first
       int comma = signature.indexOf(',', pos);
       if (comma == -1) {
-        int closing = signature.lastIndexOf('>', signature.length());
-        typeVarName = signature.substring(pos + 1, closing);
-        pos = signature.length();
+        // If not comma then perhaps semicolon
+        int semicolon = signature.indexOf(';', pos);
+        if (semicolon == -1) {
+          int closing = signature.lastIndexOf('>', signature.length());
+          typeVarName = signature.substring(pos, closing);
+          pos = signature.length();
+        } else {
+          typeVarName = signature.substring(pos, semicolon);
+          pos = semicolon + 1;
+        }
       } else {
-        typeVarName = signature.substring(pos + 1, comma);
+        typeVarName = signature.substring(pos, comma);
         pos = comma + 1;
       }
-      typeVarNames.add(typeVarName);
+      typeVarNames.add(typeVarName.trim());
     }
 
     String[] arrTypeVarNames = new String[typeVarNames.size()];