You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/06/14 22:29:30 UTC
[jira] [Commented] (GROOVY-7863) Statically compiled calls to
private outer class methods fail with multiple levels of nesting
[ https://issues.apache.org/jira/browse/GROOVY-7863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15330772#comment-15330772 ]
ASF GitHub Bot commented on GROOVY-7863:
----------------------------------------
GitHub user shils opened a pull request:
https://github.com/apache/groovy/pull/350
GROOVY-7863: Statically compiled calls to private outer class methods…
… fail with multiple levels of nesting
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/shils/groovy GROOVY-7863
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/350.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #350
----
commit b492a3465920121e6b825400f039849dc8ef6cc3
Author: Shil Sinha <sh...@gmail.com>
Date: 2016-06-14T22:27:08Z
GROOVY-7863: Statically compiled calls to private outer class methods fail with multiple levels of nesting
----
> Statically compiled calls to private outer class methods fail with multiple levels of nesting
> ---------------------------------------------------------------------------------------------
>
> Key: GROOVY-7863
> URL: https://issues.apache.org/jira/browse/GROOVY-7863
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 2.4.7
> Reporter: Shil Sinha
>
> Example:
> {code}
> @groovy.transform.CompileStatic
> class A {
> private int bar() { 123 }
>
> class B {
> int testInner() { new C().barInner() }
>
> class C {
> int barInner() { bar() }
> }
> }
> int test() {
> new B().testInner()
> }
> }
> assert new A().test() == 123
> {code}
> The code above fails with the following error at runtime:
> {code}
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'A$B@4c1d9d4b' with class 'A$B' to class 'A'
> {code}
> This occurs because the bridge method owner for an 'implicit this' private method call is assumed to be the immediate outer class.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)