8188828: Intermittent ClassNotFoundException: jdk.test.lib.Platform for compiler tests

As a work around, remove dependency from jdk.test.lib.FileInstaller to other classes in this library

Reviewed-by: iignatyev, gtriantafill, kvn, dholmes
This commit is contained in:
Ioi Lam 2017-10-09 13:11:25 -07:00
parent bf5816a2c5
commit 94760c8130

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, 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
@ -32,11 +32,18 @@ import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
// !!!
// NOTE: this class is widely used. DO NOT depend on any other classes in any test library, or else
// you may see intermittent ClassNotFoundException as in JDK-8188828
// !!!
/**
* Copy a resource: file or directory recursively, using relative path(src and dst)
* which are applied to test source directory(src) and current directory(dst)
*/
public class FileInstaller {
public static final String TEST_SRC = System.getProperty("test.src", "").trim();
/**
* @param args source and destination
* @throws IOException if an I/O error occurs
@ -45,7 +52,7 @@ public class FileInstaller {
if (args.length != 2) {
throw new IllegalArgumentException("Unexpected number of arguments for file copy");
}
Path src = Paths.get(Utils.TEST_SRC, args[0]).toAbsolutePath().normalize();
Path src = Paths.get(TEST_SRC, args[0]).toAbsolutePath().normalize();
Path dst = Paths.get(args[1]).toAbsolutePath().normalize();
if (src.toFile().exists()) {
System.out.printf("copying %s to %s%n", src, dst);