RFR: 8178867: tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java failed to clean up files
Paul Sandoz
paul.sandoz at oracle.com
Tue Apr 10 19:05:57 UTC 2018
> On Apr 10, 2018, at 11:47 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 10/04/2018 19:44, Andrey Nazarov wrote:
>> Anyone?
>>
>>> On 6 Apr 2018, at 17:10, Andrey Nazarov <andrey.x.nazarov at 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.
More information about the core-libs-dev
mailing list