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

groovy increment does not work

XMLWordPrintable

      define method in shared library:

      int getValue() {
          int i = 1
          i = ++i
      }
       
      

       throw exception:

       Caused by: hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: com.cloudbees.groovy.cps.Builder.prefixInc() is applicable for argument types: (java.lang.Integer, com.cloudbees.groovy.cps.impl.FunctionCallBlock) values: [83, com.cloudbees.groovy.cps.impl.FunctionCallBlock@66ea8f12]
       Possible solutions: prefixInc(int, com.cloudbees.groovy.cps.LValueBlock), prefixDec(int, com.cloudbees.groovy.cps.LValueBlock), postfixInc(int, com.cloudbees.groovy.cps.LValueBlock)
       at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)

      If I change

      ++i 

      to

       i + 1

      , all work perfectly.

            Unassigned Unassigned
            burtsevyg Yuriy Burtsev
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: