mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8139961: Various sjavac tests result in error on Windows (JPRT)
Test now closes Stream properly. Reviewed-by: jlahoda
This commit is contained in:
parent
922ac5ff90
commit
d2d6dd48d4
1 changed files with 10 additions and 3 deletions
|
@ -36,8 +36,9 @@
|
|||
|
||||
import com.sun.tools.javac.util.Assert;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class NoState extends SJavacTester {
|
||||
public static void main(String... args) throws Exception {
|
||||
|
@ -57,7 +58,13 @@ public class NoState extends SJavacTester {
|
|||
Assert.check(Files.exists(BIN.resolve("pkg/A.class")));
|
||||
|
||||
// Make sure we have no other files (such as a javac_state file) in the bin directory
|
||||
Assert.check(Files.list(BIN).count() == 1);
|
||||
Assert.check(Files.list(BIN.resolve("pkg")).count() == 1);
|
||||
Assert.check(countPathsInDir(BIN) == 1);
|
||||
Assert.check(countPathsInDir(BIN.resolve("pkg")) == 1);
|
||||
}
|
||||
|
||||
private long countPathsInDir(Path dir) throws IOException {
|
||||
try (Stream<Path> files = Files.list(dir)) {
|
||||
return files.count();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue