As a member of both the Gradle and Groovy teams, I must say I am very worried by this late change in strong encapsulation at runtime. As Jochen explained, it severely broke Gradle and Groovy, but more importantly, it breaks a lot of libraries. And it breaks for things that do _not_ care about modules. They are all running "old fashioned" with good old classpath. I could understand something like that happening as soon as we have one module on classpath, but this is not the case (the only modules are those from the JDK itself). And Jochen explained this could have a very large impact on the performance of Groovy, making it effectively unusable (some would argue that this is a good thing, but let's not go into that debate). Asciidoctor is broken too, due to its dependency on JRuby. That's just one example over many. The truth is that we have no clue what the impact on this change has on the larger JVM ecosystem. Transitive dependencies are a big issue, because you cannot ask all your dependencies to upgrade their code to JDK 9 as fast as we can. And for Gradle at least, we must absolutely run on older JDKs with the same code, so we cannot rely on JDK 9 specific classes or hacks to start the JVM (like add-exports).
In short I am very worried that this change could make upgrading to JDK 9 so complex that nobody would do it. 2016-10-02 9:53 GMT+02:00 Alan Bateman <alan.bate...@oracle.com>: > On 02/10/2016 01:25, Malachi de Ælfweald wrote: > > : >> >> This appears to come from a setAccessible from inside getEnv >> https://github.com/adammurdoch/native-platform/blob/master/ >> src/main/java/net/rubygrapefruit/platform/internal/ >> WrapperProcess.java#L113 >> > Indeed, as we've said in other mails, this change is going to expose a lot > hacks. In this specific case then System.getenv() is specified to return an > unmodifiable map but a library that Gradle uses seems to want to hack into > the underlying map so that it can modify it. Stack trace below. > > Jochen may be able to find out more about this, maybe there is a > description somewhere on what the real issue is. It might be something that > can be tackled in other ways. > > -Alan > > > * 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.removeEn > vInternal(WrapperProcess.java:91) > at net.rubygrapefruit.platform.internal.WrapperProcess.setEnvir > onmentVariable(WrapperProcess.java:82) > at org.gradle.internal.nativeintegration.processenvironment.Nat > ivePlatformBackedProcessEnvironment.removeNativeEnvironmentV > ariable(NativePlatformBackedProcessEnvironment.java:31) > at org.gradle.internal.nativeintegration.processenvironment.Abs > tractProcessEnvironment.removeEnvironmentVariable(AbstractPr > ocessEnvironment.java:47) > at org.gradle.internal.nativeintegration.processenvironment.Abs > tractProcessEnvironment.maybeSetEnvironment(AbstractProcessE > nvironment.java:37) > at org.gradle.launcher.daemon.server.exec.EstablishBuildEnviron > ment.doBuild(EstablishBuildEnvironment.java:65) > at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.exec > ute(BuildCommandOnly.java:36) > at org.gradle.launcher.daemon.server.api.DaemonCommandExecution > .proceed(DaemonCommandExecution.java:120) > at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.exec > ute(HintGCAfterBuild.java:44) > at org.gradle.launcher.daemon.server.api.DaemonCommandExecution > .proceed(DaemonCommandExecution.java:120) > at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWi > thBusy$1.run(StartBuildOrRespondWithBusy.java:50) > at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1. > run(DaemonStateCoordinator.java:293) > at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecord > Failures.onExecute(ExecutorPolicy.java:54) > at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(S > toppableExecutorImpl.java:40) > at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker( > ThreadPoolExecutor.java:1161) > at java.base/java.util.concurrent.ThreadPoolExecutor$Worker. > run(ThreadPoolExecutor.java:635) > at java.base/java.lang.Thread.run(Thread.java:843) > 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 @78123e82 > at java.base/jdk.internal.reflect.Reflection.throwInaccessibleO > bjectException(Reflection.java:414) > at java.base/java.lang.reflect.AccessibleObject.checkCanSetAcce > ssible(AccessibleObject.java:198) > at java.base/java.lang.reflect.Field.checkCanSetAccessible(Fiel > d.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 >