You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2018/02/01 06:24:00 UTC
[jira] [Resolved] (GROOVY-6888) Static type checking fails if I
change the closure input parameter name
[ https://issues.apache.org/jira/browse/GROOVY-6888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-6888.
-------------------------------
Resolution: Fixed
Assignee: Paul King
Fix Version/s: 2.4.14
Duplicate
> Static type checking fails if I change the closure input parameter name
> -----------------------------------------------------------------------
>
> Key: GROOVY-6888
> URL: https://issues.apache.org/jira/browse/GROOVY-6888
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.3.3, 2.4.0-beta-1, 2.4.0-rc-1
> Reporter: Mauro Molinari
> Assignee: Paul King
> Priority: Major
> Fix For: 2.4.14
>
>
> Consider the following:
> {code}
> @TypeChecked
> class A {
> @Bindable
> String foo
>
> static void main(String[] args) {
> A a = new A()
> a.foo = 'old'
> a.addPropertyChangeListener('foo') { event ->
> println 'foo changed: ' + event.oldValue + ' -> ' + event.newValue
> }
> a.foo = 'new'
> }
> }
> {code}
> The Groovy compiler fails:
> bq. [Static type checking] - No such property: oldValue for class: java.lang.Object
> This is unexpected, because if I leave the {{event}} naming of the closure input parameter and use {{it.oldValue}}/{{it.newValue}} the static type checking succeeds (as it should).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)