Skip to content

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

@mauromol

Description

@mauromol

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions