changeset 45370:4bc3aabebb15

8181335: remove packageless CompilerUtils Reviewed-by: alanb
author iignatyev
date Tue, 06 Jun 2017 19:53:35 -0700
parents 8a2eafd1861f
children f593383efdde
files test/lib/jdk/test/lib/compiler/CompilerUtils.java
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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