8156972: java/lang/reflect/Layer/LayerAndLoadersTest.java test requires jdk.compiler

Reviewed-by: alanb
This commit is contained in:
Alexandre Iline 2016-05-18 11:56:24 +01:00 committed by Alan Bateman
parent ea55d0b71b
commit b67da697df
2 changed files with 12 additions and 3 deletions
jdk/test
java/lang/reflect/Layer
lib/testlibrary

@ -24,6 +24,7 @@
/**
* @test
* @library /lib/testlibrary
* @modules jdk.compiler
* @build LayerAndLoadersTest CompilerUtils ModuleUtils
* @run testng LayerAndLoadersTest
* @summary Tests for java.lang.reflect.Layer@createWithXXX methods

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, 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
@ -50,13 +50,21 @@ public final class CompilerUtils {
*
* @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)
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