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

Eric Milles commented on GROOVY-10904:
--------------------------------------

I'm not sure if I will move the fix to Groovy 4 due to the risk involved in the 
classgen re-shuffle.  You can work around this a number of ways, including 
declaring the class {{Profile}} outside of (and above) {{Example}}.  Or you can 
declare an explicit getter.  Or you may be able to use a closure instead of a 
method reference -- replace "Profile::getName" with "\{ it.name \}".

> STC doesn't find property accessor on nested class
> --------------------------------------------------
>
>                 Key: GROOVY-10904
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10904
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.7
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Major
>
> The STC appears unable to see the property accessor for a nested class.
> {code}
> @CompileStatic
> class Example {
>   static class Profile {
>     String name
>   }
>   Map<String, Profile> PROFILES = [new Profile()]
>       .stream()
>       .collect(toMap(Profile::getName, identity()))
> }
> {code}
> {code}
> Groovy:Failed to find class method 'getName(Example$Profile)' or instance 
> method 'getName()' for the type: Example$Profile
> {code}



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

Reply via email to