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/06/14 00:18:09 UTC

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

Shil Sinha created GROOVY-7862:
----------------------------------

             Summary: 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


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)