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

Hannes Wallnöfer hannesw at openjdk.java.net
Mon May 16 09:32:48 UTC 2022


On Fri, 13 May 2022 21:51:32 GMT, Jonathan Gibbons <jjg 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.

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

> 82:         checkExit(useSourcePath ? Exit.OK : Exit.ERROR);
> 83:         checkOutput(Output.OUT, !useSourcePath,
> 84:                 "C.java:4: error: file not found on source path or snippet path: S.java");

I must admit I don't understand the rules for snippet discovery with or without --source-path argument. Would the same behavior be expcected for code in a named package?

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

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


More information about the javadoc-dev mailing list