RFR: JDK-8284037: Snippet-files subdirectory not automatically detected when in unnamed package

Jonathan Gibbons jjg at openjdk.java.net
Mon May 16 23:00:38 UTC 2022


On Mon, 16 May 2022 10:14:06 GMT, Pavel Rappo <prappo at 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`?

Yeah, I guess so ;-)

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

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


More information about the javadoc-dev mailing list