Constructor, using other methods of the class, causes "hudson.remoting.ProxyException: com.cloudbees.groovy.cps.impl.CpsCallableInvocation"

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Using the constructor, which calls to another public method of the class causes "hudson.remoting.ProxyException: com.cloudbees.groovy.cps.impl.CpsCallableInvocation" on execution:

      pipeline {
          agent none
          stages {
              stage('Processing projects') {
                  agent {label 'master'}
                  steps {
                      script {
                          def example = new Example(3)
                          println(example.getNumber())
                      }
                  }
              }
          }
      }
      
      public class Example {
          private int a;
      
          public Example() {
              a = 0;
          }
      
          public Example(int base) {
              this();
              addDoubled(base);
          }
      
          public void addDoubled(int base) {
              a += base * 2;
          }
      
          public int getNumber() {
              return a;
          }
      }
      

      Using the same class without using such constructor works fine:

      pipeline {
          agent none
          stages {
              stage('Processing projects') {
                  agent {label 'master'}
                  steps {
                      script {
                          def example = new Example()
                          example.addDoubled(3)
                          println(example.getNumber())
                      }
                  }
              }
          }
      }
      
      public class Example {
          private int a;
      
          public Example() {
              a = 0;
          }
      
          public Example(int base) {
              this();
              addDoubled(base);
          }
      
          public void addDoubled(int base) {
              a += base * 2;
          }
      
          public int getNumber() {
              return a;
          }
      }
      

            Assignee:
            Unassigned
            Reporter:
            Alexandr Panshin
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: