-
Improvement
-
Resolution: Fixed
-
Major
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.
- 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