--- a/test/lib/jdk/test/lib/compiler/CompilerUtils.java Sat Jun 03 02:43:31 2017 +0000
+++ b/test/lib/jdk/test/lib/compiler/CompilerUtils.java Tue Jun 06 19:53:35 2017 -0700
@@ -39,7 +39,6 @@
* This class consists exclusively of static utility methods for invoking the
* java compiler.
*/
-
public final class CompilerUtils {
private CompilerUtils() { }
@@ -52,13 +51,21 @@
*
* @return true if the compilation is successful
*
- * @throws IOException if there is an I/O error scanning the source tree or
- * creating the destination directory
+ * @throws IOException
+ * if there is an I/O error scanning the source tree or
+ * creating the destination directory
+ * @throws UnsupportedOperationException
+ * if there is no system java compiler
*/
- public static boolean compile(Path source, Path destination, String ... options)
+ public static boolean compile(Path source, Path destination, String... options)
throws IOException
{
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ if (compiler == null) {
+ // no compiler available
+ throw new UnsupportedOperationException("Unable to get system java compiler. "
+ + "Perhaps, jdk.compiler module is not available.");
+ }
StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
List<Path> sources