[
https://issues.apache.org/jira/browse/GROOVY-10188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-10188.
------------------------------
> Different treatment of property expressions in closures from 2.4 to 2.5
> -----------------------------------------------------------------------
>
> Key: GROOVY-10188
> URL: https://issues.apache.org/jira/browse/GROOVY-10188
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.5.14
> Reporter: Darius Cooper
> Assignee: Paul King
> Priority: Major
> Fix For: 2.5.15, 4.0.0-beta-1, 3.0.9
>
>
> We noticed a change in behavior moving from Groovy 2.4.x to 2.5.x,
> and wondering if it was an _expected_ change. It seems to be a difference
> with the compiler
> We use *groovy-eclipse-batch*.
> This is a contrived example, but based on an issue we had in PROD
> {code:groovy}
> List<Integer> myList = [1,2,3]
> myList.each { Integer -> println Integer.xxx}
> {code}
> With groovy-eclipse-batch 2.4.17-01 (and groovy 2.4.15) we get errors
> saying:
> _No such property: xxx for class: java.lang.Integer_
> However, using groovy-eclipse-batch 2.5.14-02 and Groovy 2.5.14, it prints
> out the full class name of the Integer class
> From [this Slack thread:
> |https://groovy-community.slack.com/archives/C2NEFCM55/p1627652703003000] If
> you look in the AST browser, *after conversion phase* we have:
> {code:groovy}
> public java.lang.Object run() {
> List<Integer> myList = [1, 2, 3]
> myList.each({ java.lang.Object Integer ->
> this.println( Integer .xxx)
> })
> }
> {code}
> By *end of semantic analysis phase* we have:
> {code:groovy}
> public java.lang.Object run() {
> List<Integer> myList = [1, 2, 3]
> myList.each({ java.lang.Object Integer ->
> this.println( java.lang.Integer)
> })
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)