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

toString method in shared library class not correctly resolved

XMLWordPrintable

      The following shared library class:

      package org.test;
      class X implements Serializable {
        String toString() { "X" }
      }
      

      used in a Jenkinsfile like:

      def x = new org.test.X()
      echo "${x}"
      

      will not result in any output. The output wont even show the echo step.

      However

      def x = new org.test.X()
      echo "${x.toString()}"

      will work as expected

            abayer Andrew Bayer
            pmr Philipp Moeller
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: