8300204: Sealed-class hierarchy graph missing nodes
Reviewed-by: jjg
This commit is contained in:
parent
38838b344a
commit
d8afc7beeb
@ -265,16 +265,17 @@ public final class SealedGraph implements Taglet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isInPublicApi(TypeElement typeElement, Set<String> exports) {
|
private static boolean isInPublicApi(TypeElement typeElement, Set<String> exports) {
|
||||||
return (exports.contains(packageName(typeElement.getQualifiedName().toString())) ||
|
var packageName = packageName(typeElement);
|
||||||
exports.contains(packageName(typeElement.getSuperclass().toString()))) &&
|
return packageName.isPresent() && exports.contains(packageName.get()) &&
|
||||||
typeElement.getModifiers().contains(Modifier.PUBLIC);
|
typeElement.getModifiers().contains(Modifier.PUBLIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String packageName(String name) {
|
private static Optional<String> packageName(TypeElement element) {
|
||||||
int lastDot = name.lastIndexOf('.');
|
return switch (element.getNestingKind()) {
|
||||||
return lastDot < 0
|
case TOP_LEVEL -> Optional.of(((PackageElement) element.getEnclosingElement()).getQualifiedName().toString());
|
||||||
? ""
|
case ANONYMOUS, LOCAL -> Optional.empty();
|
||||||
: name.substring(0, lastDot);
|
case MEMBER -> packageName((TypeElement) element.getEnclosingElement());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user