8187681: Compiling for target 9 while also using --patch-module

Removing limitation on simultaneous use of --release and --patch-module for system modules.

Reviewed-by: mcimadamore, jjg
This commit is contained in:
Jan Lahoda 2017-11-02 11:16:27 +01:00
parent e44c7feff9
commit c6be2c363a
5 changed files with 7 additions and 87 deletions

View File

@ -1473,11 +1473,6 @@ public class Modules extends JCTree.Visitor {
d.packge.modle = msym; d.packge.modle = msym;
} }
} }
if (!allowAccessIntoSystem && (msym.flags() & Flags.SYSTEM_MODULE) != 0 &&
msym.patchLocation != null) {
log.error(Errors.PatchModuleWithRelease(msym));
}
} }
private Set<ModuleSymbol> retrieveRequiresTransitive(ModuleSymbol msym) { private Set<ModuleSymbol> retrieveRequiresTransitive(ModuleSymbol msym) {

View File

@ -3126,10 +3126,6 @@ compiler.err.add.exports.with.release=\
compiler.err.add.reads.with.release=\ compiler.err.add.reads.with.release=\
adding read edges for system module {0} is not allowed 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=\ compiler.warn.addopens.ignored=\
--add-opens has no effect at compile time --add-opens has no effect at compile time

View File

@ -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 {
}

View File

@ -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 {
}

View File

@ -23,7 +23,7 @@
/** /**
* @test * @test
* @bug 8178152 * @bug 8178152 8187681
* @summary Verify unsupported modules and module options handling. * @summary Verify unsupported modules and module options handling.
* @library /tools/lib * @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api * @modules jdk.compiler/com.sun.tools.javac.api
@ -263,35 +263,19 @@ public class ReleaseOptionUnsupported extends TestRunner {
tb.createDirectories(patch); tb.createDirectories(patch);
new JavacTask(tb) new JavacTask(tb)
.options("-XDrawDiagnostics", .options("--patch-module", "java.base=" + patch)
"--patch-module", "java.base=" + patch)
.outdir(classes) .outdir(classes)
.files(tb.findJavaFiles(src)) .files(tb.findJavaFiles(src))
.run(Expect.SUCCESS) .run(Expect.SUCCESS)
.writeAll() .writeAll();
.getOutputLines(Task.OutputKind.DIRECT);
List<String> log; new JavacTask(tb)
List<String> expected; .options("--patch-module", "java.base=" + patch,
log = new JavacTask(tb)
.options("-XDrawDiagnostics",
"--patch-module", "java.base=" + patch,
"--release", Target.DEFAULT.multiReleaseValue()) "--release", Target.DEFAULT.multiReleaseValue())
.outdir(classes) .outdir(classes)
.files(tb.findJavaFiles(src)) .files(tb.findJavaFiles(src))
.run(Expect.FAIL) .run(Expect.SUCCESS)
.writeAll() .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);
}
//OK to patch a non-system module: //OK to patch a non-system module:
tb.createDirectories(classes); tb.createDirectories(classes);