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/05/28 15:42:12 UTC

[jira] [Updated] (GROOVY-7813) Calling a non-static outer class method from a static class passes STC

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

Shil Sinha updated GROOVY-7813:
-------------------------------
    Fix Version/s:     (was: 2.5.0-beta-1)
                   2.4.7

> Calling a non-static outer class method from a static class passes STC
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-7813
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7813
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.4.6
>            Reporter: Shil Sinha
>            Assignee: Shil Sinha
>             Fix For: 2.4.7
>
>
> Example:
> {code}
> @groovy.transform.TypeChecked
> class Foo {
>     def bar() { 2 }
>     static class Baz {
>         def doBar() {
>             bar()
>         }
>     }
> }
> new Foo.Baz().doBar()
> {code}
> The {{doBar()}} call in the method above results in a MissingMethodException. If the code is statically compiled rather than just type checked, a VerifyError occurs instead.  
> The usage of {{ClassNode#isStaticClass()}} within {{StaticTypeCheckingVisitor#findMethod(ClassNode, String, ClassNode...)}} seems to be responsible, as the former does not return true when the receiver is a static class.



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