On Thu, 23 Sep 2021 14:29:38 GMT, Jonathan Gibbons <j...@openjdk.org> wrote:

>> test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java line 802:
>> 
>>> 800:                 public FileVisitResult preVisitDirectory(Path 
>>> fromSubdir, BasicFileAttributes attrs) throws IOException {
>>> 801:                     Path toSubdir = 
>>> toDir.resolve(fromDir.relativize(fromSubdir));
>>> 802:                     if (Files.exists(toSubdir)) {
>> 
>> Shouldn't this check be negated? Otherwise, sub-folders are not copied. On 
>> the second thought, why do we need this check at all?
>
> Oops.
> Whether it is needed depends on whether you think the target directory exists 
> or not.  In the one existing use case, the directory should not exist and so 
> the  check is not necessary.   Given that tests run in an empty scratch dir, 
> we could reasonably assume that is the case.

This method (`copyDir`) does not really belong in `JavadocTester`.  It's only 
used in one test, so could be moved there, but a better home is in `ToolBox` 
which already has similar methods.  I'll move it there.

Separately, I see `ToolBox` could use some TLC/updates ... e.g. use `Path.of` 
instead of `Paths.get` but I'll defer that to a separate issue.

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

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

Reply via email to