-
Bug
-
Resolution: Unresolved
-
Minor
-
Jenkins 2.32.3, 2.46.3
Shared Groovy Libraries 2.7, 2.8
Pipeline Groovy 2.33, 2.34
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.
[JENKINS-44616] groovy increment does not work
Environment |
Original:
Jenkins 2.32.3 Shared Groovy Libraries 2.7 |
New:
Jenkins 2.32.3, 2.46.3 Shared Groovy Libraries 2.7, 2.8 |
Description |
Original:
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) Why? |
New:
define method {code:java} getValue() { int i = 1 i = ++i } {code} {code:java} 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){code} Why? |
Description |
Original:
define method {code:java} getValue() { int i = 1 i = ++i } {code} {code:java} 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){code} Why? |
New:
define method in shared library: {code:java} int getValue() { int i = 1 i = ++i } {code} throw exception: {code:java} 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){code} If I change {code:java} ++i {code} to {code:java} i + 1{code} , all work perfectly. |
Assignee | New: Jesse Glick [ jglick ] |
Assignee | Original: Jesse Glick [ jglick ] |
Component/s | New: workflow-cps-global-lib-plugin [ 21714 ] | |
Component/s | Original: core [ 15593 ] |
Labels | New: pipeline |
I'm just commenting for the sake of commenting. I'm not an expert in groovy but it's the first time I see someone trying to use unary arithmetics operators (++ and --) in this manner. Isn't
an error as ++i will automatically increments i
What happens when you try
or
instead? does that work?