8146727: test tools/sjavac/IncludeExcludePatterns.java fails on Windows

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2016-01-08 22:24:15 -08:00
parent cbaccb91f0
commit aeca638f85

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@
import com.sun.tools.javac.util.Assert;
import com.sun.tools.sjavac.server.Sjavac;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@ -104,7 +105,7 @@ public class IncludeExcludePatterns extends SjavacBase {
// Puts an empty (dummy) class definition in the given path.
void writeDummyClass(Path javaFile) throws IOException {
String pkg = javaFile.getParent().toString().replace('/', '.');
String pkg = javaFile.getParent().toString().replace(File.separatorChar, '.');
String cls = javaFile.getFileName().toString().replace(".java", "");
toolbox.writeFile(SRC.resolve(javaFile), "package " + pkg + "; class " + cls + " {}");
}