groovy
  1. groovy
  2. GROOVY-3120

closure fails to call missingMethod in delegate

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      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
      

        Activity

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            blackdrag blackdrag
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: