String (String signature, List<? super String> parameters, List<? super List<GenericType>> bounds) { if (signature.charAt(0) != '<') { return signature; } int counter = 1; int index = 1; loop: while (index < signature.length()) { switch (signature.charAt(index)) { case '<' -> counter++; case '>' -> { counter--; if (counter == 0) { break loop; } } } index++; } String value = signature.substring(1, index); signature = signature.substring(index + 1); while (value.length() > 0) { int to = value.indexOf(":"); String param = value.substring(0, to); value = value.substring(to + 1); List<GenericType> lstBounds = new ArrayList<>(); while (true) { if (value.charAt(0) == ':') { // empty superclass, skip value = value.substring(1); } String bound = GenericType.getNextType(value); lstBounds.add(new GenericType(bound)); value = value.substring(bound.length()); if (value.length() == 0 || value.charAt(0) != ':') { break; } else { value = value.substring(1); } } parameters.add(param); bounds.add(lstBounds); } return signature; }