Mercurial > hg > jdk9-shenandoah > langtools
changeset 2898:05e2e446b7d0
8078861: tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java fails on Windows
Reviewed-by: vromero
author | jjg |
---|---|
date | Tue, 28 Apr 2015 18:57:51 -0700 |
parents | 524255b0bec0 |
children | 1a5121a90ecf |
files | test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java Tue Apr 28 22:25:36 2015 +0200 +++ b/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java Tue Apr 28 18:57:51 2015 -0700 @@ -21,12 +21,14 @@ * questions. */ +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.*; import java.util.function.Function; import java.util.function.Supplier; +import java.util.regex.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -69,13 +71,13 @@ .collect(Collectors.toMap(ExpectedClass::className, Function.identity())); this.classes = new HashMap<>(); Path classDir = getClassDir().toPath(); - String sourceFileName = testCaseName.replace('.', '/'); + Pattern filePattern = Pattern.compile(Pattern.quote(testCaseName.replace('.', File.separatorChar)) + ".*\\.class"); List<Path> paths = Files.walk(classDir) .map(p -> classDir.relativize(p.toAbsolutePath())) - .filter(p -> p.toString().matches(sourceFileName + ".*\\.class")) + .filter(p -> filePattern.matcher(p.toString()).matches()) .collect(Collectors.toList()); for (Path path : paths) { - String className = path.toString().replace(".class", "").replace('/', '.'); + String className = path.toString().replace(".class", "").replace(File.separatorChar, '.'); classes.put(className, readClassFile(classDir.resolve(path).toFile())); } if (classes.isEmpty()) {