[ https://issues.apache.org/jira/browse/GROOVY-7702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15073196#comment-15073196 ]
ASF GitHub Bot commented on GROOVY-7702: ---------------------------------------- GitHub user shils opened a pull request: https://github.com/apache/groovy/pull/227 GROOVY-7702: @CompileStatic and the method with(Closure) seem to dete… …rmine wrong type You can merge this pull request into a Git repository by running: $ git pull https://github.com/shils/groovy GROOVY-7702 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/227.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #227 ---- commit 06e84dfb7a5a7e4af119f38a59c157d6907f703d Author: Shil Sinha <sh...@apache.org> Date: 2015-12-28T22:16:09Z GROOVY-7702: @CompileStatic and the method with(Closure) seem to determine wrong type ---- > @CompileStatic and the method with(Closure) seem to determine wrong type > ------------------------------------------------------------------------ > > Key: GROOVY-7702 > URL: https://issues.apache.org/jira/browse/GROOVY-7702 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.4.4, 2.4.5 > Reporter: Teerapong Suksuwan > Priority: Minor > > In the code below. When refer to time without the "it" prefix. The compiler > get type of "time" wrongly. "time" is Date but it determined as long. > {code} > @CompileStatic > class GMain { > static void main(String[] args) { > Calendar.instance.with { > println time.class//This print java.util.Date which is OK > Date d1 = time//This line failed to compile with error Groovyc: > [Static type checking] - Cannot assign value of type long to variable of type > java.util.Date > Date d2 = it.time//This line is OK > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)