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

groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: script

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • workflow-cps-plugin
    • None

      groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: script for class: my.lib.MyClass
      

      This error is thrown when running (MyClass is loaded from a shared library):

      @Library("my-lib") _
      new my.lib.MyClass(this)
      

      MyClass:

      package my.lib
      
      class MyClass implements Serializable {
      
          final protected script
      
          MyClass(script) {
              this.script = script
          }
      }
      

      Is this expected? Disabling the sandbox the problem goes away.

          [JENKINS-45824] groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: script

          Andrew Bayer added a comment -

          What version of workflow-cps are you using? I know some changes have gone in lately for dealing better with {{final}}s.

          Andrew Bayer added a comment - What version of workflow-cps are you using? I know some changes have gone in lately for dealing better with {{final}}s.

            Unassigned Unassigned
            amuniz Antonio Muñiz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: