On Fri, 26 Nov 2021 14:31:04 GMT, Julia Boes <jb...@openjdk.org> wrote:
>> make/jdk/src/classes/build/tools/taglet/ToolGuide.java line 159: >> >>> 157: .toString() >>> 158: .replace('.', '/') >>> 159: .replaceAll("[^/]+", ".."); >> >> If the class is in a module don't you have to get one step higher to get the >> root? >> I am not familiar with this code, so I'm just reasoning by induction here - >> trying to match with what the case for PACKAGE seems to be doing... > > Same here, I initially applied the same pattern as for PACKAGE but that does > not produce the correct path (it includes 1 ".." too much.): > > String typePart = te.getQualifiedName() > .toString() > .replace('.', '/') > .replaceAll("[^/]+", ".."); > return te.getEnclosingElement().getEnclosingElement() != null > ? "../" + typePart > : typePart; I see - class has a class name which is a file - so `foo.Bar` produces `../..` relative to the directory foo (foo/../..) - so it already has an additional `..` compared to package - where `a.b` would produce ../.. relative to *directory* b which would lead to `b/../..` and not `a/../..` which is what we need. The difference comes from the fact that `Bar` is a file whereas `b` is a directory. ------------- PR: https://git.openjdk.java.net/jdk/pull/6566