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

closure fails to call missingMethod in delegate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.6-rc-1, 1.5.8, 1.7-beta-1
    • None
    • None

    Description

      the following scripts fails, because the methodMissing not in A throws a MissingMethodException, but the Exception is not catched, because it is wrapped in a invokerInvocationException and not unpacked correctly. As a result the Closure code fails to catch the MissingMethodException and does no longer call A#missingMethod

      class A {
        def invokeMethod(String name, args) {
           "A" 
        }
      }
      
      def methodMissing(String name, args) {
        visited=true
        throw new MissingMethodException(name,this.class,args)
      }
      
      visited=false
      def closure = { foo() }
      closure.delegate = new A()
      assert closure() == "A"
      assert visited==true
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: