You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Shil Sinha (JIRA)" <ji...@apache.org> on 2016/07/17 15:27:20 UTC

[jira] [Resolved] (GROOVY-7862) Statically compiled calls to protected methods of an outerclass' superclass result in IllegalAccessErrors

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

Shil Sinha resolved GROOVY-7862.
--------------------------------
       Resolution: Fixed
         Assignee: Shil Sinha
    Fix Version/s: 2.5.0-beta-1

Merged to Master only as the fix uses changes made for GROOVY-7325 which were not backported.

> Statically compiled calls to protected methods of an outerclass' superclass result in IllegalAccessErrors
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7862
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7862
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.4.7
>            Reporter: Shil Sinha
>            Assignee: Shil Sinha
>             Fix For: 2.5.0-beta-1
>
>
> Example:
> {code}
> package one;
> public class Base {
>     protected int foo() {
>         123
>     }
> }
> {code}
> {code}
> package two;
> class SubBase extends Base {
>     class Inner {
>         int test() {
>             foo()
>         }
>     }
>     
>     int innerTest() {
>         new Inner().test()
>     }
> }
> assert new SubBase().innerTest() == 123
> {code}
> The code above will fail with the following error:
> {code}
> java.lang.IllegalAccessError: tried to access method one.Base.foo()I from class two.SubBase$Inner
> {code}
> This is due to bridge methods for protected methods not being correctly generated (and subsequently used when writing protected method invocations.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)