Skip to content

Commit 4b7f027

Browse files
lgxbslgxVicente Romero
authored and
Vicente Romero
committedApr 24, 2021
8231179: Investigate why tools/javac/options/BCPOrSystemNotSpecified.java fails on Window
Reviewed-by: vromero
1 parent d87a4c3 commit 4b7f027

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎test/langtools/ProblemList.txt

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java
5050
tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java 8057687 generic-all emit correct byte code an attributes for type annotations
5151
tools/javac/warnings/suppress/TypeAnnotations.java 8057683 generic-all improve ordering of errors with type annotations
5252
tools/javac/modules/SourceInSymlinkTest.java 8180263 windows-all fails when run on a subst drive
53-
tools/javac/options/BCPOrSystemNotSpecified.java 8231179 windows-all fails when creating a test bootclasspath
5453

5554
###########################################################################
5655
#

‎test/langtools/tools/javac/options/BCPOrSystemNotSpecified.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
2828
* @library /tools/lib
2929
* @modules jdk.compiler/com.sun.tools.javac.api
3030
* jdk.compiler/com.sun.tools.javac.main
31+
* jdk.compiler/com.sun.tools.javac.file
3132
* @build toolbox.ToolBox toolbox.JavacTask toolbox.TestRunner
3233
* @run main BCPOrSystemNotSpecified
3334
*/
@@ -43,6 +44,7 @@
4344
import java.util.EnumSet;
4445
import javax.tools.JavaFileManager;
4546
import javax.tools.JavaFileObject;
47+
import javax.tools.StandardJavaFileManager;
4648
import javax.tools.StandardLocation;
4749
import javax.tools.ToolProvider;
4850
import toolbox.JavacTask;
@@ -51,6 +53,8 @@
5153
import toolbox.TestRunner;
5254
import toolbox.ToolBox;
5355

56+
import com.sun.tools.javac.file.PathFileObject;
57+
5458
public class BCPOrSystemNotSpecified extends TestRunner {
5559

5660
private final ToolBox tb = new ToolBox();
@@ -192,7 +196,7 @@ protected void runTests() throws Exception {
192196
}
193197

194198
private void prepareBCP(Path target) throws IOException {
195-
try (JavaFileManager jfm = ToolProvider.getSystemJavaCompiler()
199+
try (StandardJavaFileManager jfm = ToolProvider.getSystemJavaCompiler()
196200
.getStandardFileManager(null, null, null)) {
197201
for (String pack : new String[] {"", "java.lang", "java.lang.annotation", "jdk.internal.javac"}) {
198202
JavaFileManager.Location javaBase =
@@ -206,7 +210,9 @@ private void prepareBCP(Path target) throws IOException {
206210
Files.createDirectories(targetDir);
207211
try (InputStream in = file.openInputStream()) {
208212
String sourcePath = file.getName();
209-
int sepPos = sourcePath.lastIndexOf(fileSep);
213+
// Here, we should use file system separator instead of the operating system separator.
214+
String fileSystemSep = jfm.asPath(file).getFileSystem().getSeparator();
215+
int sepPos = sourcePath.lastIndexOf(fileSystemSep);
210216
String fileName = sourcePath.substring(sepPos + 1);
211217
Files.copy(in, targetDir.resolve(fileName));
212218
}

0 commit comments

Comments
 (0)
Please sign in to comment.