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()];