Skip to content
Permalink
Browse files
8231179: Investigate why tools/javac/options/BCPOrSystemNotSpecified.…
…java fails on Window

Reviewed-by: vromero
  • Loading branch information
lgxbslgx authored and Vicente Romero committed Apr 24, 2021
1 parent d87a4c3 commit 4b7f0274077d78ad15d2357f6b15c6e364e4a039
Showing 2 changed files with 9 additions and 4 deletions.
@@ -50,7 +50,6 @@ tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java
tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java 8057687 generic-all emit correct byte code an attributes for type annotations
tools/javac/warnings/suppress/TypeAnnotations.java 8057683 generic-all improve ordering of errors with type annotations
tools/javac/modules/SourceInSymlinkTest.java 8180263 windows-all fails when run on a subst drive
tools/javac/options/BCPOrSystemNotSpecified.java 8231179 windows-all fails when creating a test bootclasspath

###########################################################################
#
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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
@@ -28,6 +28,7 @@
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.file
* @build toolbox.ToolBox toolbox.JavacTask toolbox.TestRunner
* @run main BCPOrSystemNotSpecified
*/
@@ -43,6 +44,7 @@
import java.util.EnumSet;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
import toolbox.JavacTask;
@@ -51,6 +53,8 @@
import toolbox.TestRunner;
import toolbox.ToolBox;

import com.sun.tools.javac.file.PathFileObject;

public class BCPOrSystemNotSpecified extends TestRunner {

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

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

1 comment on commit 4b7f027

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 4b7f027 Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.