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

Daniel Sun resolved GROOVY-8542.
--------------------------------
    Resolution: Fixed
      Assignee: Daniel Sun

Fixed by: 
https://github.com/apache/groovy/commit/bc254b19f2d585da5430ea5fa81b72e0761efd31

> Support creating instances of non-static inner classes with Java-Like syntax 
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-8542
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8542
>             Project: Groovy
>          Issue Type: New Feature
>            Reporter: Daniel Sun
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 3.0.0-alpha-2, 2.6.0-alpha-4
>
>
>  
> [http://groovy.329449.n5.nabble.com/About-creating-instances-of-non-static-inner-classes-with-Java-Like-syntax-td5749462.html]
>  
> {code:java}
> public class Y {
>     public class X {
>         def name
>         public X(String name) {
>             this.name = name
>         }
>     }
>     public static Y createY() {
>         return new Y()
>     }
>     public static X createX(Y y) {
>         return y.new X('Daniel')
>     }
>     public static X createX() {
>         return createY().new X('Daniel')
>     }
>     public static String getXName() {
>         return createY().new X('Daniel').name
>     }
>     public static String getXName2() {
>         return createY().
>                         new X('Daniel')
>                                         .name
>     }
> }
> def createY() {
>     return new Y()
> }
> assert 'Daniel' == Y.createX(new Y()).name
> assert 'Daniel' == Y.createX().name
> assert 'Daniel' == Y.getXName()
> assert 'Daniel' == Y.getXName2()
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to