8317937: @sealedGraph: Links to inner classes fails in links

Reviewed-by: pminborg
This commit is contained in:
Chen Liang 2023-11-07 15:07:17 +00:00 committed by Per Minborg
parent 134c382d39
commit 4a0ad462ab

View File

@ -229,7 +229,7 @@ public final class SealedGraph implements Taglet {
var forwardNavigator = nodePackage.getQualifiedName().toString()
.replace(".", "/");
return backNavigator + forwardNavigator + "/" + node.getSimpleName() + ".html";
return backNavigator + forwardNavigator + "/" + packagelessCanonicalName(node) + ".html";
}
public void addEdge(TypeElement node, TypeElement subNode) {
@ -315,5 +315,14 @@ public final class SealedGraph implements Taglet {
case MEMBER -> packageName((TypeElement) element.getEnclosingElement());
};
}
private static String packagelessCanonicalName(TypeElement element) {
String result = element.getSimpleName().toString();
while (element.getNestingKind() == NestingKind.MEMBER) {
element = (TypeElement) element.getEnclosingElement();
result = element.getSimpleName().toString() + '.' + result;
}
return result;
}
}
}