}
}
// L PackageSpecifier* SimpleClassTypeSignature ClassTypeSignature* ;
private ClassTypeSignature parseClassTypeSignature() {
SimpleClassTypeSignature outerType = null;
SimpleClassTypeSignature[] nestedTypes = new SimpleClassTypeSignature[0];
StringBuffer ret = new StringBuffer();
String identifier = eatIdentifier();
ret.append(identifier);
while (maybeEat("/")) {
ret.append("/"); // dont forget this...
ret.append(eatIdentifier());
}
identifier = ret.toString();
// now we have either a "." indicating the start of a nested type,
// or a "<" indication type arguments, or ";" and we are done.
while (!maybeEat(";")) {
if (maybeEat(".")) {
// outer type completed
outerType = new SimpleClassTypeSignature(identifier);
List<SimpleClassTypeSignature> nestedTypeList = new ArrayList<SimpleClassTypeSignature>();
do {
ret.append(".");
SimpleClassTypeSignature sig = parseSimpleClassTypeSignature();
ret.append(sig.toString());
nestedTypeList.add(sig);
} while (maybeEat("."));
nestedTypes = new SimpleClassTypeSignature[nestedTypeList.size()];
nestedTypeList.toArray(nestedTypes);
} else if (tokenStream[tokenIndex].equals("<")) {
ret.append("<");
TypeArgument[] tArgs = maybeParseTypeArguments();
for (int i = 0; i < tArgs.length; i++) {
ret.append(tArgs[i].toString());
}
ret.append(">");
outerType = new SimpleClassTypeSignature(identifier, tArgs);
// now parse possible nesteds...
List<SimpleClassTypeSignature> nestedTypeList = new ArrayList<SimpleClassTypeSignature>();
while (maybeEat(".")) {
ret.append(".");
SimpleClassTypeSignature sig = parseSimpleClassTypeSignature();
ret.append(sig.toString());
nestedTypeList.add(sig);
}
nestedTypes = new SimpleClassTypeSignature[nestedTypeList.size()];
nestedTypeList.toArray(nestedTypes);
} else {
throw new IllegalStateException("Expecting .,<, or ;, but found " + tokenStream[tokenIndex] + " while unpacking "
+ inputString);
}
}
ret.append(";");
if (outerType == null)
outerType = new SimpleClassTypeSignature(ret.toString());
return new ClassTypeSignature(ret.toString(), outerType, nestedTypes);
}