From 4a0ad462abc2e1c92ea9b9af8333badc0df1afa9 Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Tue, 7 Nov 2023 15:07:17 +0000 Subject: [PATCH] 8317937: @sealedGraph: Links to inner classes fails in links Reviewed-by: pminborg --- .../src/classes/build/tools/taglet/SealedGraph.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/make/jdk/src/classes/build/tools/taglet/SealedGraph.java b/make/jdk/src/classes/build/tools/taglet/SealedGraph.java index 787789fa0d0..fd1b73355b3 100644 --- a/make/jdk/src/classes/build/tools/taglet/SealedGraph.java +++ b/make/jdk/src/classes/build/tools/taglet/SealedGraph.java @@ -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; + } } }