Reputation: 9059
Using current JDK build 9-ea+143
's javax.tools.JavaCompiler
tool, I can compile the simple (empty) example module without an error:
module com.foo.bar { }
If I add open
as in:
open module com.foo.bar { }
...the compiler error reads:
/module-info.java:1: error: class, interface, or enum expected
open module com.foo.bar {
^
Syntax based on http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
Is the current JDK 9 build not up-to-date with this spec or am I missing an option to be passed to JavaCompiler
?
Upvotes: 0
Views: 384
Reputation: 51010
To get the newest Jigsaw features, you need to use 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 - it definitely works on b146.
Upvotes: 1