On Thu, 23 Sep 2021 12:08:38 GMT, Pavel Rappo <pra...@openjdk.org> wrote:

>> Please review a moderately simple update to convert JavadocTester to just 
>> use NIO, instead of a mix of File and NIO.
>> 
>> The original code used java.io.File. At some point (JDK 9-ish) new code was 
>> added that used NIO, resulting in a mix. This change converts the old code 
>> to use NIO as well.
>> 
>> This is mostly internal, with two changes that affect tests.
>> 
>> 1. The `protected` field `outputDir` is changed from a `File` to a `Path`.   
>> Some tests use `outputDir` directly, typically to convert it to a `Path`.
>> 2. The `copyDir` method had a strange spec.  Partly, it used "target" to 
>> describe the directory being copied, but worse, it copied the entire source 
>> directory INTO the destination directory, as compared to copying the 
>> contents.  The method was just used in a single test, so I've changed the 
>> spec of the method and the use in the test.  This cleaned up a "TODO" as 
>> well, to use `Files.walkFileTree` for the copy.
>
> test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java line 795:
> 
>> 793:      */
>> 794:     public void copyDir(Path fromDir, Path toDir) {
>> 795:         out.println("Copying " + fromDir + " to " + toDir);
> 
> I was surprised to find out there's no convenience method in java.nio.file 
> for copying file trees. In its absence we could maybe use something closer to 
> the second usage example in FileVisitor?

That example is somewhat overkill, since it handles symlinks as well, which we 
don't need.

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

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

Reply via email to