# HG changeset patch # User jlahoda # Date 1509617787 -3600 # Node ID 8fee80b92e65149f7414250fd5e34b6f35d417b4 # Parent d0cb66d8cbf1f70e79fdf188c6dc8a4898ad5561 8187681: Compiling for target 9 while also using --patch-module Summary: Removing limitation on simultaneous use of --release and --patch-module for system modules. Reviewed-by: mcimadamore, jjg diff -r d0cb66d8cbf1 -r 8fee80b92e65 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Thu Nov 02 10:09:34 2017 +0100 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Thu Nov 02 11:16:27 2017 +0100 @@ -1473,11 +1473,6 @@ d.packge.modle = msym; } } - - if (!allowAccessIntoSystem && (msym.flags() & Flags.SYSTEM_MODULE) != 0 && - msym.patchLocation != null) { - log.error(Errors.PatchModuleWithRelease(msym)); - } } private Set retrieveRequiresTransitive(ModuleSymbol msym) { diff -r d0cb66d8cbf1 -r 8fee80b92e65 src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Nov 02 10:09:34 2017 +0100 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Nov 02 11:16:27 2017 +0100 @@ -3126,10 +3126,6 @@ compiler.err.add.reads.with.release=\ adding read edges for system module {0} is not allowed with --release -# 0: symbol -compiler.err.patch.module.with.release=\ - patching system module {0} is not allowed in combination with --release - compiler.warn.addopens.ignored=\ --add-opens has no effect at compile time diff -r d0cb66d8cbf1 -r 8fee80b92e65 test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/PatchModuleWithRelease.java --- a/test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/PatchModuleWithRelease.java Thu Nov 02 10:09:34 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// key: compiler.err.patch.module.with.release -// options: --release 9 - -class PatchModuleWithRelease { -} diff -r d0cb66d8cbf1 -r 8fee80b92e65 test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/patchmodule/java.base/java/lang/Test.java --- a/test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/patchmodule/java.base/java/lang/Test.java Thu Nov 02 10:09:34 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.lang; - -class Test { -} diff -r d0cb66d8cbf1 -r 8fee80b92e65 test/langtools/tools/javac/options/release/ReleaseOptionUnsupported.java --- a/test/langtools/tools/javac/options/release/ReleaseOptionUnsupported.java Thu Nov 02 10:09:34 2017 +0100 +++ b/test/langtools/tools/javac/options/release/ReleaseOptionUnsupported.java Thu Nov 02 11:16:27 2017 +0100 @@ -23,7 +23,7 @@ /** * @test - * @bug 8178152 + * @bug 8178152 8187681 * @summary Verify unsupported modules and module options handling. * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -263,35 +263,19 @@ tb.createDirectories(patch); new JavacTask(tb) - .options("-XDrawDiagnostics", - "--patch-module", "java.base=" + patch) + .options("--patch-module", "java.base=" + patch) .outdir(classes) .files(tb.findJavaFiles(src)) .run(Expect.SUCCESS) - .writeAll() - .getOutputLines(Task.OutputKind.DIRECT); + .writeAll(); - List log; - List expected; - - log = new JavacTask(tb) - .options("-XDrawDiagnostics", - "--patch-module", "java.base=" + patch, + new JavacTask(tb) + .options("--patch-module", "java.base=" + patch, "--release", Target.DEFAULT.multiReleaseValue()) .outdir(classes) .files(tb.findJavaFiles(src)) - .run(Expect.FAIL) - .writeAll() - .getOutputLines(Task.OutputKind.DIRECT); - - expected = Arrays.asList( - "- compiler.err.patch.module.with.release: java.base", - "1 error" - ); - - if (!expected.equals(log)) { - throw new AssertionError("Unexpected output: " + log); - } + .run(Expect.SUCCESS) + .writeAll(); //OK to patch a non-system module: tb.createDirectories(classes);