RFR: JDK-8314975: JavadocTester should set source path if not specified
Jonathan Gibbons
jjg at openjdk.org
Tue Sep 5 19:06:38 UTC 2023
On Mon, 28 Aug 2023 12:01:23 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> I understand why you are doing it, but I wonder if it is possible to do it in a better way. If this is integrated, tests that use JavadocTester will always specify `-sourcepath`. That won't be clean and will likely cause suprises down the road.
To clarify what I think you mean: tests that use JavaDocTester will have some suitable source path is set for the underlying invocation of javadoc, either implicit (to `testSrc`) or explicit (given as args to the `javadoc` call.)
To me, that is cleaner than letting the source path default to the class path and whatever is on that.
The only time this will be an issue is if we want to specifically test `javadoc` behavior when the source path is _not_ set explicitly. That would be a very small minority of tests, in `test/langtools/jdk/javadoc/tool`, and for any such tests, there are other convenient ways to invoke `javadoc` without going through `JavadocTester`, such as `toolbox.JavadocTask`.
If it was seen to be really important, we could set a flag on `JavadocTester` to override the proposed behavior to always set a sensible value, but so far I'm not seeing the use case. If we were to do that, any tests using the feature would probably have to ensure a sensible value is set for the class path (that being the default value for the source path, if that is not set.)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15424#issuecomment-1707167740
More information about the javadoc-dev
mailing list