private Type parseImpl(String type) throws ReflectionRequiredException {
if (type.endsWith("[]")) {
String remainder = type.substring(0, type.length() - 2);
Type componentType = this.getType(remainder);
return getArrayType(componentType);
}
if (type.endsWith(">")) {
int bracket = type.indexOf('<');
if (bracket == -1) {
throw new RuntimeException(
"Mismatched brackets; expected '<' to match subsequent '>'");
}
// Resolve the raw type.
//
String rawTypeName = type.substring(0, bracket);
Type rawType = getType(rawTypeName);
//For parameterised type, we just erase it.
if (rawType != null)
return rawType;
}
Type result = findPrimitiveType(type);
if (result != null) {
return result;
}
result = findType(type);