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

Double-quoted string literals perceived as String instead of as GString

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • pipeline
    • None
    • Jenkins 2.252.

      I declared the following var module in a shared pipeline library:

      {{call(
      GString msbuildloc,
      GString arguments,
      GString projloc,
      GString projfile)}}

      and invoke it from a declarative piplene with the following arguments:

      {{gt_msbuild(
      "C:
      Program Files (x86)\\MSBuild\\14.0\\Bin
      ",
      "${MSBUILD_PARAMS} /p:Configuration=Debug;Platform=AnyCPU;DotNetVer=${DotNetVer}",
      "$ProjDir",
      "Common.Encrypter.csproj")}}

      The invocation fails with the following error:

      {{No signature of method: gt_msbuild.call() is applicable for argument types:
      ( java.lang.String,
      org.codehaus.groovy.runtime.GStringImpl,
      org.codehaus.groovy.runtime.GStringImpl,
      java.lang.String)}}

      As you see, the percevied argument type of a double-quoted string depends on whether it contains actual interpolation or not. This is counterintuitive, incompatible with Groovy, and hard to work with. So much so that I consider it bug. Double-quoted string literals should treated consistently.

            Unassigned Unassigned
            ant_222 Anton Shepelev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: