You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2024/11/12 11:41:00 UTC

[jira] [Closed] (GROOVY-11393) STC: error for non-static member of class delegate

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

Paul King closed GROOVY-11393.
------------------------------

> STC: error for non-static member of class delegate
> --------------------------------------------------
>
>                 Key: GROOVY-11393
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11393
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 3.0.21, 5.0.0-alpha-8, 4.0.21
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-9
>
>
> Consider the following:
> {code:groovy}
> class Foo {
>   static getBar() { 'bar' }
>   Object getBaz() { 'baz' }
> }
> @groovy.transform.TypeChecked
> void test() {
>   def foo = Foo
>   foo.with {
>     println bar
>     println baz
>     println getBar()
>     println getBaz()
>   }
> }
> test()
> {code}
> This script prints "bar" and then throws a {{MissingPropertyException}} or {{ClassCastException}} (static compilation).  The type checker does not warn of non-static member access for a {{Class}} delegate.
> GROOVY-9415, GROOVY-9618, GROOVY-10820



--
This message was sent by Atlassian Jira
(v8.20.10#820010)