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

Method invocation syntax does not work properly with ComposedClosures

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8-beta-2
    • 1.8-beta-3
    • None
    • None

    Description

      The problem is with metaprogramming and the ComposedClosure class. Because the ComposedClosure class does not implement the doCall method and the MetaClassImpl.invokeMethod method does not provide any special handling for ComposedClosures as it does for CurriedClosures and MethodClosures, the invocation of the doCall method in the method resolution process will fail. For example:

      class ComposedTest {
      def closure1 = {}
      def closure2 = {}
      def composed = closure1 >> closure2

      }
      def inst = new ComposedTest()

      // This is fine because ComposedClosure implements the call method.
      //inst.composed.call()

      // This fails because ComposedClosure does not implement the doCall method.
      inst.composed()

      Attachments

        Activity

          People

            paulk Paul King
            hendersk Kirsten Schwark
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: