Current Java 9 status and roadmap

Hi there, before I throw some time at this, I’d like to check whether anybody knows of an up-to-date reference of what Gradle functionality is supposed to work with the latest build of Java9 (at the time of writing that is 9-ea+154)?

When I run gradle tasks with it, I immediately get ExceptionInInitializerError with cause:

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected java.lang.Package[] java.lang.ClassLoader.getPackages() accessible: module java.base does not "opens java.lang" to unnamed module @7cb502c
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:207)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:192)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:186)
        at org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:42)
        at org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:32)
        at org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:36)
        at org.gradle.internal.reflect.JavaReflectionUtil.method(JavaReflectionUtil.java:223)
        at org.gradle.internal.classloader.FilteringClassLoader.<clinit>(FilteringClassLoader.java:49)
        ... 47 more

What is interesting is that running on TravisCI trusty, using 9-ea+140 I get a different error (complaining about the Kotlin plugin trying to get Unsafe)

I tried to look at the internet and I saw an announcement that Gradle 3.0 is supposed to work with JDK9, but not with the Jigsaw branch. Now that the Jigsaw branch is merged, does it mean we can not run Gradle on JDK 9 anymore?

Has anybody tried running Gradle on Java8 and cross-compiling to Java9?

Slightly unrelated, the last design document for Java9 support lists a number of features related ot modularization. Are these still current? (as most of them refer to the model/rule based config) The new Java Library plugin separates the API from implementation deps, which is a great first step. Is there a plan to provide DSL for API packages? Any tentative timeline about that?

I spent another hour and found gradle#1095 - while that issue is about running tests it answered my question about TravisCI Java9 vs latest and greatest.

I tried the workaround by setting env variable to force-open java.lang as follows:

export GRADLE_OPTS=--add-opens java.base/java.lang=ALL-UNNAMED
gradlew tasks

At first it didn’t make a difference until I scratched my head some more and carefully read the output:

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.   //                              <== IMPORTANT
This problem might be caused by incorrect configuration of the daemon. // READ THE LINE ABOVE
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.ExceptionInInitializerError (no error message)

Then I tried:

gradlew --no-daemon tasks
...
:buildSrc:build UP-TO-DATE  // IT'S WORKING!!!

FAILURE: Build failed with an exception. // almost...

* Where:
Build file '.../build.gradle' line: 19

* What went wrong:
An exception occurred applying plugin request [id: 'com.jfrog.artifactory', version: '4.4.8']
> Failed to apply plugin [id 'com.jfrog.artifactory']
   > No signature of method: static java.util.Collections.newSetFromMap() is applicable for argument types: (java.util.concurrent.ConcurrentHashMap) values: [[:]]

I just did a quick test and it appears that Groovy has problems dispatching some calls when ran under Java9. As a quick test I run this in the Groovy shell:

Collections.newSetFromMap([:])

It fails in Groovy 2.4.7 + Java9 with the same exception as above, but succeeds in 2.4.8 + Java9.

Any chance we can get a Gradle Groovy version upgrade for 3.4?