--add-opens on an automatic module ?

Kevin Rushforth kevin.rushforth at oracle.com
Thu Dec 15 15:02:52 UTC 2016


Is it possible that this exception, which seems harmless as far as I can 
tell, predates the latest jdk-9+148 jigsaw updates, and that the only 
reason we are seeing it now is because of the 
"-Dsun.reflect.debugModuleAccessChecks=true" ?

-- Kevin


David Hill wrote:
>
> Alan,
>
> I thought I would toss you the options and the full exception just in 
> case you see something really obvious.
>
> thanks,
>    Dave
>
> public class GradleResolveVisitor extends ResolveVisitor {
>
>
> Running with jdk build 148, gradle 3.1
>
> ddhill at ddhill-pad:~/sb/9/graphics/rt$ echo $_JAVA_OPTIONS
> -Dsun.reflect.debugModuleAccessChecks=true 
> --add-opens=java.base/java.lang=ALL-UNNAMED 
> --add-opens=java.base/java.util=ALL-UNNAMED 
> --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 
> --add-opens=java.base/java.io=ALL-UNNAMED 
> --add-opens=java.base/java.util.concurrent=ALL-UNNAMED 
> --add-opens=java.base/java.text=ALL-UNNAMED
>
> I get this, I think only when a gradle deamon starts.
>
> java.lang.IllegalAccessException: class 
> org.gradle.groovy.scripts.internal.GradleResolveVisitor cannot access 
> a member of class org.codehaus.groovy.control.ClassNodeResolver with 
> modifiers "protected static final"
>     at 
> java.base/jdk.internal.reflect.Reflection.throwIllegalAccessException(Reflection.java:418) 
>
>     at 
> java.base/jdk.internal.reflect.Reflection.throwIllegalAccessException(Reflection.java:409) 
>
>     at 
> java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:111) 
>
>     at 
> java.base/java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:364) 
>
>     at 
> java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:356) 
>
>     at java.base/java.lang.reflect.Field.checkAccess(Field.java:1065)
>     at java.base/java.lang.reflect.Field.get(Field.java:406)
>     at 
> org.gradle.groovy.scripts.internal.GradleResolveVisitor.<clinit>(GradleResolveVisitor.java:760) 
>
>     at 
> org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler$CustomCompilationUnit.<init>(DefaultScriptCompilationHandler.java:283) 
>
>     at 
> org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler$1.createCompilationUnit(DefaultScriptCompilationHandler.java:111) 
>
>     at 
> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:277)
>     at 
> groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
>     at 
> org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:129) 
>
>     at 
> org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(DefaultScriptCompilationHandler.java:89) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:153) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:134) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:177) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:157) 
>
>     at 
> org.gradle.cache.internal.DefaultPersistentDirectoryCache$Initializer.initialize(DefaultPersistentDirectoryCache.java:98) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheAccess$2.run(DefaultCacheAccess.java:104) 
>
>     at 
> org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:179) 
>
>     at 
> org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:169) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:102) 
>
>     at 
> org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:46) 
>
>     at 
> org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:28) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheFactory.doOpen(DefaultCacheFactory.java:80) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheFactory.open(DefaultCacheFactory.java:50) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.doOpen(DefaultCacheRepository.java:138) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheRepository$AbstractCacheBuilder.open(DefaultCacheRepository.java:121) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$RemapBuildScriptsAction.execute(FileCacheBackedScriptClassCompiler.java:349) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$RemapBuildScriptsAction.execute(FileCacheBackedScriptClassCompiler.java:325) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:177) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:157) 
>
>     at 
> org.gradle.cache.internal.DefaultPersistentDirectoryCache$Initializer.initialize(DefaultPersistentDirectoryCache.java:98) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheAccess$2.run(DefaultCacheAccess.java:104) 
>
>     at 
> org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:179) 
>
>     at 
> org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:169) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:102) 
>
>     at 
> org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:46) 
>
>     at 
> org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:28) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheFactory.doOpen(DefaultCacheFactory.java:80) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheFactory.open(DefaultCacheFactory.java:50) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.doOpen(DefaultCacheRepository.java:138) 
>
>     at 
> org.gradle.cache.internal.DefaultCacheRepository$AbstractCacheBuilder.open(DefaultCacheRepository.java:121) 
>
>     at 
> org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler.compile(FileCacheBackedScriptClassCompiler.java:98) 
>
>     at 
> org.gradle.groovy.scripts.internal.CrossBuildInMemoryCachingScriptClassCache.getOrCompile(CrossBuildInMemoryCachingScriptClassCache.java:46) 
>
>     at 
> org.gradle.groovy.scripts.internal.BuildScopeInMemoryCachingScriptClassCompiler.compile(BuildScopeInMemoryCachingScriptClassCompiler.java:48) 
>
>     at 
> org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:50) 
>
>     at 
> org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:151) 
>
>     at 
> org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38) 
>
>     at 
> org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25) 
>
>     at 
> org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34) 
>
>     at 
> org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55) 
>
>     at 
> org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:573) 
>
>     at 
> org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:125) 
>
>     at 
> org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42) 
>
>     at 
> org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38) 
>
>     at 
> org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:151) 
>
>     at org.gradle.internal.Factories$1.create(Factories.java:22)
>     at 
> org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 
>
>     at 
> org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53) 
>
>     at 
> org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:148) 
>
>     at 
> org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33) 
>
>     at 
> org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112) 
>
>     at 
> org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:106) 
>
>     at 
> org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 
>
>     at 
> org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63) 
>
>     at 
> org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106) 
>
>     at 
> org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:92) 
>
>     at 
> org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66) 
>
>     at 
> org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) 
>
>     at 
> org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 
>
>     at 
> org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) 
>
>     at 
> org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) 
>
>     at 
> org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:79) 
>
>     at 
> org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:51) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) 
>
>     at org.gradle.util.Swapper.swap(Swapper.java:38)
>     at 
> org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44) 
>
>     at 
> org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
>
>     at 
> org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) 
>
>     at 
> org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293) 
>
>     at 
> org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) 
>
>     at 
> org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.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:844)
>
>
> On 12/14/16, 1:04 PM, Alan Bateman wrote:
>> On 14/12/2016 17:21, David Hill wrote:
>>
>>>
>>> I have yet another gradle exception:
>>>
>>> java.lang.IllegalAccessException: class 
>>> org.gradle.groovy.scripts.internal.GradleResolveVisitor cannot 
>>> access a member of class 
>>> org.codehaus.groovy.control.ClassNodeResolver with modifiers 
>>> "protected static final"
>>>
>>> Gradle is trying to use a jar it is packaged with likely 
>>> (groovy-all-2.4.7.jar)
>>>
>>> A quick search online did not show me how to specify a (presumably) 
>>> automatic module in the
>>>
>>>    --add-opens=module/package=consumer
>>>
>>> argument.
>> Automatic modules open all their packages and so the --add-opens here 
>> with be a no-op.
>>
>> As regards the IllegalAccessException then I don't know the types 
>> involved here so know if 
>> org.gradle.groovy.scripts.internal.GradleResolveVisitor is a sub-type 
>> of org.codehaus.groovy.control. or not. It's possible this is nothing 
>> to do with modules but running with 
>> -Dsun.reflect.debugModuleAccessChecks=true might reveal something 
>> useful.
>>
>> -Alan
>
>


More information about the jigsaw-dev mailing list