Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-26300

CPS interpreter fails on calls to find(), findAll() default methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: pipeline
    • Labels:
      None
    • Similar Issues:

      Description

      The CPS interpreter does not translate calls to .find() , .findAll() default methods correctly.

      The following test case fails:

      assert evalCPS("[1,2,3].find { it > 1 }") == 2
      

      I see that groovy-cps has an CpsDefaultGroovyMethods class that provides an alternate implementation of each(). Does this mean that all methods that accept a closure as an argument will also fail?

        Attachments

          Issue Links

            Activity

            Hide
            batmat Baptiste Mathus added a comment - - edited

            I can confirm simple functional-style programming does not seem to work (collect neither). Wondering if I should file another issue, just let me know.

            Btw, groovy-cps each() test method indeed fails for me on the github current master (60d8d9c6aa5299baee679e14069e36347973e45f). Wondering if it's platform specific or why Jesse managed to cut the 1.2 two days ago.

            Update: the test above fails on Windows, but not on Linux. Didn't investigate as to why.

            Show
            batmat Baptiste Mathus added a comment - - edited I can confirm simple functional-style programming does not seem to work (collect neither). Wondering if I should file another issue, just let me know. Btw, groovy-cps each() test method indeed fails for me on the github current master (60d8d9c6aa5299baee679e14069e36347973e45f). Wondering if it's platform specific or why Jesse managed to cut the 1.2 two days ago. Update: the test above fails on Windows, but not on Linux. Didn't investigate as to why.
            Hide
            kbaltrinic Kenneth Baltrinic added a comment -

            It seems that this case was closed by mistake.  It was closed as a dup of 26307 but 26307 was closed as a duplicate of this, and I just hit this issue again.  Seems it should be re-opened?

            Show
            kbaltrinic Kenneth Baltrinic added a comment - It seems that this case was closed by mistake.  It was closed as a dup of 26307 but 26307 was closed as a duplicate of this, and I just hit this issue again.  Seems it should be re-opened?
            Hide
            macdrega Joerg Schwaerzler added a comment -

            Looks the same to me.

            Just encountered this issue.

            Is it possible to fix it?

            Show
            macdrega Joerg Schwaerzler added a comment - Looks the same to me. Just encountered this issue. Is it possible to fix it?

              People

              Assignee:
              kohsuke Kohsuke Kawaguchi
              Reporter:
              akbertram Alexander Bertram
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: