On Fri, 13 May 2022 21:51:32 GMT, Jonathan Gibbons <j...@openjdk.org> wrote:

> Please review a small fix to address use of snippets in source code in the 
> unnamed package.
> 
> The core of the fix is to replace `packageName(pkg, utils)` (which returns 
> `"<Unnamed>"` for the unnamed package) with plain old 
> `pkg.getQualifiedName().toString()` (which returns an empty string for the 
> unnamed package.)
> 
> There's some minor localized cleanup and rearrangement as well.
> 
> The test verifies behavior without and then with a source path, since that is 
> the likely path of discovery by a user playing with the unnamed package.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/SnippetTaglet.java
 line 221:

> 219:                 var utils = writer.configuration().utils;
> 220:                 var pkg = getPackageElement(holder, utils);
> 221:                 var pkgLocn = utils.getLocationForPackage(pkg);

Can the name be `pkgLocation`?

test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetUnnamedPackage.java 
line 82:

> 80: 
> 81:         javadoc(args.toArray(String[]::new));
> 82:         checkExit(useSourcePath ? Exit.OK : Exit.ERROR);

Thanks for taking into account our discussion in #8583.

On the one hand, this way of conditionally adding an option is more mouthful. 
On the other hand, it doesn't make a first-time reader scratch their head and 
makes for a cleaner test.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8708

Reply via email to