--add-opens on an automatic module ?

Kevin Rushforth kevin.rushforth at oracle.com
Wed Dec 14 19:18:33 UTC 2016

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.ClassNodeResolver or not. It's possible 
> this is nothing to do with modules but running with 
> -Dsun.reflect.debugModuleAccessChecks=true might reveal something useful.

We are already running with "-Dsun.reflect.debugModuleAccessChecks=true" 
and I don't see anything obvious. I do note that when I see this, which 
isn't very often, it seems only to be a warning; I haven't noticed any 
problems as a result. As to whether or not it has anything to do with 
modules, you might be right. It did only start happening with jdk-9+148 
though (we didn't get with build 147 prior to switching).

-- Kevin

More information about the jigsaw-dev mailing list