You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/02/24 19:39:00 UTC

[jira] [Updated] (GROOVY-9328) Cannot call private member of containing class in @CS

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

Eric Milles updated GROOVY-9328:
--------------------------------
    Fix Version/s: 2.5.16

> Cannot call private member of containing class in @CS
> -----------------------------------------------------
>
>                 Key: GROOVY-9328
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9328
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.5.8
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.0-rc-3, 2.5.16
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {code:java}
> class C {
>     private C() {}
>     private privateMethod() {}
>     def anonymousUsage() {
>         new Runnable() {
>             @groovy.transform.CompileStatic
>             @Override
>             void run() {
>                 privateMethod()
>                 new C()
>             }
>         }
>     }
> }{code}
> Expected: code is compiled without errors.
>  Actual: 2  errors:
> {{Cannot call private method C#privateMethod from class C$1}}
> {{Cannot call private constructor for C from class C$1}}
> Note that Java compiles the same code just fine.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)