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 2021/12/14 19:16:00 UTC
[jira] [Resolved] (GROOVY-8050) Reference outer class property via inner class
[ https://issues.apache.org/jira/browse/GROOVY-8050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-8050.
---------------------------------
Fix Version/s: 4.0.0-rc-2
Resolution: Fixed
> Reference outer class property via inner class
> ----------------------------------------------
>
> Key: GROOVY-8050
> URL: https://issues.apache.org/jira/browse/GROOVY-8050
> Project: Groovy
> Issue Type: Bug
> Components: Compiler, Static compilation, Static Type Checker
> Affects Versions: 2.4.7
> Reporter: Daniil Ovchinnikov
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-rc-2
>
>
> {code}
> @CompileStatic
> class Outer {
> def foo = 1
> Inner createInner() { new Inner() }
> class Inner {}
> }
> @CompileStatic // works without @CompileStatic
> class Main {
> static void main(String[] args) {
> def i = new Outer().createInner()
> println i.foo // [Static type checking] - No such property: foo for class: Outer$Inner
> }
> }
> {code}
> I think should work in both static and dynamic contexts or fail in both.
> Please close this issue if this is by design.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)