Details
-
Improvement
-
Status: Resolved (View Workflow)
-
Major
-
Resolution: Fixed
Description
A script like
class C { int x } def c = new C() c.x = 5 sh "echo ${c.x}"
will fail since the local variable c is of a nonserializable type. You need to explicitly say
class C implements Serializable { // ...
Since groovy-cps demands that local variables may be serialized, any locally defined classes must also be serializable (unless they are only ever being passed to binary methods: legal but unlikely).
Perhaps the transformer could implicitly add implements Serializable to any class declarations it finds. Generally this is harmless: if the class in fact contains some nonserializable fields, trying to serialize an instance will still fail in a predictable way.
Attachments
Issue Links
- is duplicated by
-
JENKINS-39699 regression: arrays of objects no longer serializable
-
- Resolved
-
- is related to
-
JENKINS-25925 More polite reporting of NotSerializableException
-
- Open
-
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Epic Link | JENKINS-35390 [ 171183 ] |
Workflow | JNJira [ 167792 ] | JNJira + In-Review [ 182845 ] |
Component/s | pipeline-general [ 21692 ] |
Component/s | workflow-plugin [ 18820 ] |
Component/s | workflow-cps-plugin [ 21713 ] | |
Component/s | pipeline [ 21692 ] |
Link |
This issue is duplicated by |
Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
Priority | Minor [ 4 ] | Major [ 3 ] |
Link | This issue is related to JENKINS-25925 [ JENKINS-25925 ] |
Assignee | Jesse Glick [ jglick ] | Andrew Bayer [ abayer ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | In Review [ 10005 ] |
Remote Link | This issue links to "groovy-cps PR #71 (Web Link)" [ 17676 ] |
Resolution | Fixed [ 1 ] | |
Status | In Review [ 10005 ] | Resolved [ 5 ] |
Remote Link | This issue links to "CloudBees Internal CD-283 (Web Link)" [ 19071 ] |
groovy-cps PR up at https://github.com/cloudbees/groovy-cps/pull/71