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

Did you forget the `def` keyword?

XMLWordPrintable

      Pipeline: Groovy 4030.v7c3a_975886a_8 introduced a warning for forgotten def keywords (related PR). After the update those entries appeared in the build logs. However, even a minimal Pipelines prints them multiple times:

      Did you forget the `def` keyword? WorkflowScript seems to be setting a field named delegate (to a value of type WorkflowScript) which could lead to memory leaks or other issues.
      Did you forget the `def` keyword? WorkflowScript seems to be setting a field named resolveStrategy (to a value of type Integer) which could lead to memory leaks or other issues.
      

      Example to reproduce:

      pipeline {
          agent any
      
          stages {
              stage("Test") {
                  steps {
                      echo("ABC")
                  }
              }
          }
      }
      

      Here the message above appears twice: after "Start of Pipeline" and "Stage (Test)".

       

      There are warnings regarding delegate and resolveStrategy on all pipelines, but there's no hint how / what to fix, nor are they user written.

        1. declarative.png
          49 kB
          Valentin Delaye
        2. folder_properties.png
          22 kB
          Valentin Delaye
        3. folder_properties2.png
          23 kB
          Valentin Delaye
        4. image-2025-03-25-12-57-53-037.png
          99 kB
          Sohaib

            jglick Jesse Glick
            ethorsa ethorsa
            Votes:
            1 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: