Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested closure loses reference to delegate of the outer closure #377

Closed
mauromol opened this issue Nov 8, 2017 · 2 comments
Closed

Nested closure loses reference to delegate of the outer closure #377

mauromol opened this issue Nov 8, 2017 · 2 comments

Comments

@mauromol
Copy link

mauromol commented Nov 8, 2017

Consider the following Groovy classes:

package test7

import java.beans.PropertyChangeSupport

class B extends PropertyChangeSupport {
  Object info
}

And:

package test7

import java.beans.PropertyChangeEvent

import javax.annotation.PostConstruct

class D {
  B bean
  @PostConstruct
  void init() {
    bean.with {
      addPropertyChangeListener('name') { PropertyChangeEvent event ->
        info
      }
    }
  }
}

The info reference is not recognized by Greclipse inside the inner closure. It should be a reference to B.info, by virtue of the outer with closure.

@eric-milles
Copy link
Member

ready to test

@mauromol
Copy link
Author

This works fine in 2.9.2.xx-201711100505-e46, thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants