> On Apr 10, 2018, at 11:47 AM, Alan Bateman <alan.bate...@oracle.com> wrote:
> 
> On 10/04/2018 19:44, Andrey Nazarov wrote:
>> Anyone?
>> 
>>> On 6 Apr 2018, at 17:10, Andrey Nazarov <andrey.x.naza...@oracle.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Please review fix in Jlink test. The fix is to close the Stream which works 
>>> with a file system.
>>> 
>>> Review: http://cr.openjdk.java.net/~anazarov/JDK-8178867/webrev.01 
>>> <http://cr.openjdk.java.net/~anazarov/JDK-8178867/webrev.01>
>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8178867
>>> 
> If you want, you can get rid of temporary javaFiles list and use 
> .forEach(args::add) instead.
> 

Yes. Not suggesting you do this, just for educational purposes you can also do 
this (not tested) e.g.:

var argStream = Stream.of("-d", destination.toString(), "--module-source-path", 
srcpath);
try (var pathStream = Files.walk(source)) {
    argStream = Stream.concat(argStream,
        pathStream.map(Path::toString).filter(s -> s.endsWith(".java")));

    int rc = JAVAC_TOOL.run(System.out, System.err, 
argStream.toArray(String[]::new));
    Assert.assertEquals(rc, 0);
}

Paul.

Reply via email to