When building with Java 9 some methods can't be called

I am trying to run my build script with Java 9-ea+159

I have set:

GRADLE_OPTS=--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED

In my build script I call java.time.LocalDate.now(). This works when I run the script with Java 8. With Java 9, I get the following error:

> No signature of method: static java.time.LocalDate.now() is applicable for argument types: () values: []
  Possible solutions: any(), any(groovy.lang.Closure), use([Ljava.lang.Object;), is(java.lang.Object), use(java.util.List, groovy.lang.Closure), use(java.lang.Class, groovy.lang.Closure)

Version details:

$ gradle --version

------------------------------------------------------------
Gradle 3.4.1
------------------------------------------------------------

Build time:   2017-03-03 19:45:41 UTC
Revision:     9eb76efdd3d034dc506c719dac2955efb5ff9a93

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          9-ea (Oracle Corporation 9-ea+159)
OS:           Mac OS X 10.12.3 x86_64

Quite likely the same issue as: https://github.com/gradle/gradle/issues/1431

You may want to try with Gradle 3.5 nightlies.

Yes, quite likely.

I discovered that this was an oversight on my part in that I needed yet another --add-opens to get reflection to work for those additional classes. So it can be worked around with Gradle 2.4.1.

Thanks.

Hi, Could you please provide your final GRADLE_OPTS. Thanks

GRADLE_OPTS=--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED