8181335: remove packageless CompilerUtils

Reviewed-by: alanb
This commit is contained in:
Igor Ignatyev 2017-06-06 19:53:35 -07:00
parent 9ab2bb8ea4
commit d577ab1f77

View File

@ -39,7 +39,6 @@ import java.util.stream.Collectors;
* This class consists exclusively of static utility methods for invoking the * This class consists exclusively of static utility methods for invoking the
* java compiler. * java compiler.
*/ */
public final class CompilerUtils { public final class CompilerUtils {
private CompilerUtils() { } private CompilerUtils() { }
@ -52,13 +51,21 @@ public final class CompilerUtils {
* *
* @return true if the compilation is successful * @return true if the compilation is successful
* *
* @throws IOException if there is an I/O error scanning the source tree or * @throws IOException
* if there is an I/O error scanning the source tree or
* creating the destination directory * 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 throws IOException
{ {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); 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); StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
List<Path> sources List<Path> sources