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

Closure.toString() calls the closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3
    • 1.6.4, 1.7-beta-1
    • None
    • None

    Description

      http://permalink.gmane.org/gmane.comp.lang.groovy.user/42103

      When using a closure to mock an interface, it should not be called when invoking methods, that are not declared in the interface:

      ==================================
      Closure failing = {
      throw new RuntimeException("for test")
      }

      interface MyType {
      def abc()
      def xyz()
      }

      MyType instance = failing as MyType

      // ****** all 3 calls below result in the closure to be invoked *****
      instance.abc()
      instance.xyz()
      instance.toString()
      ==================================

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            campariorange Jan Rudert
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: