提交 ecc99a09 编写于 作者: J jlahoda

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
上级 375e760e
......@@ -1473,11 +1473,6 @@ public class Modules extends JCTree.Visitor {
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) {
......
......@@ -3126,10 +3126,6 @@ compiler.err.add.exports.with.release=\
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
......
/*
* 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 {
}
/*
* 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 {
}
......@@ -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 @@ public class ReleaseOptionUnsupported extends TestRunner {
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);
List<String> log;
List<String> expected;
.writeAll();
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册