RFR: 8164408: Add module support for @see, @link and @linkplain javadoc tags.
Hannes Wallnoefer
HANNES.WALLNOEFER at ORACLE.COM
Tue Jun 2 14:13:56 UTC 2020
Am 01.06.2020 um 16:55 schrieb Jonathan Gibbons <jonathan.gibbons at oracle.com>:
>
> Unless I'm missing something, it still seems wrong to put the trimmedSig in the tree, instead of the sig. You already have the module name available as a separate parameter to the newReferenceTree call.
>
> I'm concerned that if you parse the comment, then print it (i.e. use .toString()) then the output will not be the same as the original.
>
That’s correct, the toString() representation and default link label will be different from the actual string in the doc comment. The rationale is that the trailing slash is there just to disambiguate the link as a module reference, and the slash is not part of the actual module name.
If it is important to preserve the link signature as-is we can keep it in the signature. We’ll have to check for it later on when checking for external module references, but that is not a problem.
Hannes
> -- Jon
>
>
>
> 486 String sig = newString(pos, bp);
> 487
>
> 488
> 489 try {
>
> 490 ReferenceParser.Reference ref = new ReferenceParser(fac).parse(sig);
> 491 // Remove trailing slash that marks this as a module reference
> 492 String trimmedSig = sig.endsWith("/") ? sig.substring(0, sig.length() -1) : sig;
> 493 return m.at(pos).newReferenceTree(trimmedSig,
> 494 ref.moduleName, ref.qualExpr,
> 495 ref.member, ref.paramTypes)
> 496 .setEndPos(bp);
More information about the javadoc-dev
mailing list