8325369: @sealedGraph: Bad link to image for tag on nested classes

Reviewed-by: jjg
This commit is contained in:
Chen Liang 2024-07-11 16:07:03 +00:00
parent dea92742c2
commit d06d79c809

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -107,7 +107,7 @@ public final class SealedGraph implements Taglet {
throw new RuntimeException(e);
}
String simpleTypeName = element.getSimpleName().toString();
String simpleTypeName = packagelessCanonicalName(typeElement).replace('.', '/');
String imageFile = simpleTypeName + "-sealed-graph.svg";
int thumbnailHeight = 100; // also appears in the stylesheet
String hoverImage = "<span>"
@ -315,14 +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;
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;
}
}