[ 
https://issues.apache.org/jira/browse/GROOVY-9596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles reassigned GROOVY-9596:
-----------------------------------

    Assignee:     (was: Eric Milles)

> Cannot access protected field of Java superclass with --illegal-access=deny
> ---------------------------------------------------------------------------
>
>                 Key: GROOVY-9596
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9596
>             Project: Groovy
>          Issue Type: Bug
>          Components: bytecode
>    Affects Versions: 3.0.4, 2.5.12
>         Environment: JDK 14
> Groovy 2.5.12 or 3.0.4
>            Reporter: Kevin Rushforth
>            Priority: Major
>         Attachments: Main.groovy, Main2.groovy, MyAWTEvent.groovy, 
> MyFilterReader.groovy
>
>
> When using the Java option {{--illegal-access=deny}}, a Groovy subclass that 
> extends a Java superclass in the Java runtime (e.g., a class in the 
> {{java.base}} module) cannot access a protected field in the parent class 
> using {{this.fieldName}}.
> To reproduce this bug, use JDK 14 (or later) and run the following using 
> either Groovy 2.5.12 or 3.0.4:
> {{$ groovyc Main.groovy MyFilterReader.groovy}}
>  {{$ _JAVA_OPTIONS="--illegal-access=deny" groovy Main}}
> It works correctly without {{--illegal-access=deny}}. You can add 
> {{-Dsun.reflect.debugModuleAccessChecks=access}} to get more detailed 
> information about the illegal access exceptions that are being swallowed by 
> Groovy.
> {{$ _JAVA_OPTIONS="--illegal-access=deny 
> -Dsun.reflect.debugModuleAccessChecks=access" groovy Main}}
> WORKAROUND: change the following line in the Groovy subclass:
> line = ((BufferedReader)this.in).readLine();
> to:
> line = ((BufferedReader)super.in).readLine();



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to