# HG changeset patch # User alanb # Date 1463568984 -3600 # Node ID 3ae899b05d36d7200e4c196f1862d8d2eaed95ae # Parent f5b2f9c076effad74700d72438b8712ea54cea55 8156972: java/lang/reflect/Layer/LayerAndLoadersTest.java test requires jdk.compiler Reviewed-by: alanb Contributed-by: alexandre.iline@oracle.com diff -r f5b2f9c076ef -r 3ae899b05d36 jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java --- a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java Wed May 18 15:03:39 2016 +0530 +++ b/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java Wed May 18 11:56:24 2016 +0100 @@ -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 diff -r f5b2f9c076ef -r 3ae899b05d36 jdk/test/lib/testlibrary/CompilerUtils.java --- a/jdk/test/lib/testlibrary/CompilerUtils.java Wed May 18 15:03:39 2016 +0530 +++ b/jdk/test/lib/testlibrary/CompilerUtils.java Wed May 18 11:56:24 2016 +0100 @@ -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 @@ * * @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 sources