[GRADLE-3565] Java9 / Jigsaw (b136) issues Created: 21/Sep/16  Updated: 18/Jan/17  Resolved: 18/Jan/17

Status: Resolved
Project: Gradle
Affects Version/s: 3.0
Fix Version/s: None

Type: Bug
Reporter: Jendrik Johannes (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 1


 Description   

There are several reports that Gradle 3.x broke with Java9 b136.

https://discuss.gradle.org/t/jigsaw-b136-gradle-problem/19580

https://discuss.gradle.org/t/urlclassloader-classcastexception/19579

https://mail-archives.apache.org/mod_mbox/groovy-dev/201609.mbox/%3CCADQzvmn_NqB843%3DTVJFvZww7KDcEgxG2Xsr5dDHWkLtq_ZMXEg%40mail.gmail.com%3E



 Comments   
Comment by Alan Bateman [ 15/Oct/16 ]

We are seeing two issues when using Gradle 3.1 with the Jigsaw EA builds:

  • Exception is:
    java.lang.ExceptionInInitializerError
    at org.gradle.initialization.DefaultClassLoaderRegistry.restrictToGradleApi(DefaultClassLoaderRegistry.java:48)
    at org.gradle.initialization.DefaultClassLoaderRegistry.<init>(DefaultClassLoaderRegistry.java:31)
    at org.gradle.internal.service.scopes.GlobalScopeServices.createClassLoaderRegistry(GlobalScopeServices.java:208)
    :
    Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected java.lang.Package[] java.lang.ClassLoader.getPackages() accessible: module java.base does not "exports private java.lang" to unnamed module @14f9390f
    at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:414)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:198)
    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:34)
    at org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:38)
    at org.gradle.internal.reflect.JavaReflectionUtil.method(JavaReflectionUtil.java:224)
    at org.gradle.internal.classloader.FilteringClassLoader.<clinit>(FilteringClassLoader.java:48)
    ... 39 more

This one can be worked around by running Gradle with `--add-exports-private java.base/java.lang=ALL-UNNAMED`.

The second one is uglier:

  • Exception is:
    net.rubygrapefruit.platform.NativeException: Unable to get mutable environment variable map.
    at net.rubygrapefruit.platform.internal.WrapperProcess.getEnv(WrapperProcess.java:113)
    at net.rubygrapefruit.platform.internal.WrapperProcess.removeEnvInternal(WrapperProcess.java:91)
    at net.rubygrapefruit.platform.internal.WrapperProcess.setEnvironmentVariable(WrapperProcess.java:82)
    :
    Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: module java.base does not "exports private java.util" to unnamed module @3bf9ce3e
    at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:414)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:198)
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
    at net.rubygrapefruit.platform.internal.WrapperProcess.getEnv(WrapperProcess.java:110)
    ... 17 more

where it should be possible to workaround with `--add-exports-private java.base/java.util=ALL-UNNAMED`, assuming there is a way to get this option into the command line of the launched VM.

Comment by Alan Bateman [ 15/Oct/16 ]

There was a discussion on jigsaw-dev about this recently:
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2016-October/009551.html

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Alan Bateman [ 15/Nov/16 ]

I think this issue is very high priority as there are many developers trying to use Gradle with JDK 9 and running into problems. The JavaFX build is one one example. There are also Oracle products trying to use Gradle with JDK 9 and running into the issues in this JIRA.

Comment by Daniel Lacasse (Inactive) [ 18/Jan/17 ]

gradle/gradle#890 is going to be used to track all Jigsaw runtime related work for Gradle. We encourage you to subscribe to that issue.

Generated at Wed Jun 30 12:52:07 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.