Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3556

'this' reference in closure of a closure not correctly resolved when using @Category annotation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.6.5, 1.7-beta-2
    • None
    • None
    • groovy eclipse 1.6.3 + eclipse 3.4 + mac os x jvm 1.5

    Description

      'this" in two imbricated closures not resolved to method parameter.

      The following test case fails :

      @Category(Guy)
      class Filtering {
      	List process() {
      		this.messages.findAll{it.name != this.getName()}
      	}
      }
      
      interface Guy {
      	String getName()
      	List getMessages()
      }
      
      class MyGuyver implements Guy {
      	List messages
      	String name
      }
      
      def onetest = new MyGuyver(
      		name: 'coucou',
      		messages : [['name':'coucou'], ['name':'test'], ['name':'salut']])
      
      Guy.mixin 	Filtering
      
      assert onetest.process() == onetest.messages.findAll{it.name != onetest.getName()}
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            lwi Louis Foucart
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: