8063074: test/tools/javac/plugin/showType/Test.java fails on Windows

Reviewed-by: ksrini
This commit is contained in:
Jonathan Gibbons 2014-11-05 19:48:42 -08:00
parent a75d2dbd39
commit c4f3406133
2 changed files with 7 additions and 3 deletions

View File

@ -85,9 +85,9 @@ public class Test {
.run();
File plugin = new File(pluginClasses.getPath(), "META-INF/services/com.sun.source.util.Plugin");
tb.writeFile(plugin.getPath(),"ShowTypePlugin");
tb.writeFile(plugin.getPath(), "ShowTypePlugin\n");
tb.new JarTask()
.run("cf", pluginJar.getPath(),"-C", pluginClasses.getPath(), ".");
.run("cf", pluginJar.getPath(), "-C", pluginClasses.getPath(), ".");
testCommandLine("-Xplugin:showtype", ref1);
testCommandLine("-Xplugin:showtype PI", ref2);

View File

@ -1475,7 +1475,11 @@ public class ToolBox {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
try {
JarEntry e = new JarEntry(base.relativize(file).normalize().toString());
String p = base.relativize(file)
.normalize()
.toString()
.replace(File.separatorChar, '/');
JarEntry e = new JarEntry(p);
jos.putNextEntry(e);
jos.write(Files.readAllBytes(file));
jos.closeEntry();