Strip generics from parent classes properly

Fixes the handling of non-static inner classes `Parent<A>.Child` if the parent has generics, #20
This commit is contained in:
Erich Schubert 2018-03-28 16:01:35 +02:00 committed by Erich Schubert
parent 5cd82f641e
commit 40b24774eb
1 changed files with 11 additions and 2 deletions

View File

@ -1013,8 +1013,17 @@ class ClassGraph {
int openIdx = name.indexOf('<');
if(openIdx == -1)
return name;
else
return name.substring(0, openIdx);
StringBuilder buf = new StringBuilder(name.length());
for (int i = 0, depth = 0; i < name.length(); i++) {
char c = name.charAt(i);
if (c == '<')
depth++;
else if (c == '>')
depth--;
else if (depth == 0)
buf.append(c);
}
return buf.toString();
}
/** Convert the class name into a corresponding URL */