JDK 编译器对 "open" 模块失败
JDK compiler fails for "open" module
使用当前 JDK build 9-ea+143
的 javax.tools.JavaCompiler
工具,我可以编译简单(空)示例模块而不会出错:
module com.foo.bar { }
如果我添加 open
如:
open module com.foo.bar { }
...编译器错误为:
/module-info.java:1: error: class, interface, or enum expected
open module com.foo.bar {
^
语法基于http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
当前的 JDK 9 版本是否不符合此规范,或者我是否缺少要传递给 JavaCompiler
的选项?
要获得最新的 Jigsaw 功能,您需要使用 the Jigsaw EA build (as opposed to the regular EA builds). I created a GitHub repo exploring open packages and modules (to make reflection work) and also wrote about it - 它绝对适用于 b146。
使用当前 JDK build 9-ea+143
的 javax.tools.JavaCompiler
工具,我可以编译简单(空)示例模块而不会出错:
module com.foo.bar { }
如果我添加 open
如:
open module com.foo.bar { }
...编译器错误为:
/module-info.java:1: error: class, interface, or enum expected
open module com.foo.bar {
^
语法基于http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
当前的 JDK 9 版本是否不符合此规范,或者我是否缺少要传递给 JavaCompiler
的选项?
要获得最新的 Jigsaw 功能,您需要使用 the Jigsaw EA build (as opposed to the regular EA builds). I created a GitHub repo exploring open packages and modules (to make reflection work) and also wrote about it - 它绝对适用于 b146。