[jira] [Commented] (GROOVY-9779) Inconsistency with callable properties in static context

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (GROOVY-9779) Inconsistency with callable properties in static context

Eric Milles (Jira)

    [ https://issues.apache.org/jira/browse/GROOVY-9779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17213852#comment-17213852 ]

Daniil Ovchinnikov commented on GROOVY-9779:
--------------------------------------------

After this change the following tests pass:

{code:groovy}
        assertScript '''  
            class C {
                def call() { return 42 }
            }
            class C1 {
                def call = new C()
            }
            class C2 {
                def call = new C1()
            }
            class C3 {
                def call = new C2()
            }
            class D {
                final y = new C3()
            }
            assert new D().y() == 42
        '''
{code}

{code:groovy}
        assertScript '''  
            class C {
                def call(a) { return 42 }
            }
            class C1 {
                def call = new C()
            }
            class C2 {
                def plus = new C1()
            }
            assert new C2() + 1 == 42
        '''
{code}

> Inconsistency with callable properties in static context
> --------------------------------------------------------
>
>                 Key: GROOVY-9779
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9779
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.6
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.7, 4.0.0-alpha-2
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {code:title=playground.groovy}
> class C {
>     def call() {
>         42
>     }
> }
> class Container {
>     static final staticC   = new C()
>     def          instanceC = new C()
> }
> assert Container.staticC() == 42 // works fine
> def container = new Container()
> assert container.staticC() == 42 // MissingMethodException
> assert container.instanceC() == 42 // MissingMethodException
> {code}
> I'd expect the invocations to fail or to work in both static and instance contexts.



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