Re: XStream Serialization: SortedSet vs. NavigableSet vs. TreeSet

2022-10-17 Thread 'Jesse Glick' via Jenkins Developers
On Mon, Oct 17, 2022 at 5:43 AM Ullrich Hafner 
wrote:

> Shouldn’t XStream always pick the correct dynamic type (and not the static
> type) when serializing things?
>

As far as I know it does, but then again the representation for exotic
collection types is complex.

You should declare the persisted field to be of some simpler type,
preferably `ArrayList`. If you need to enforce uniqueness, sorting, etc. in
memory during operations, do so using any other mechanism, perhaps a
`transient` field.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2w0LfDEQV3uybALYmJG7houQumg3oNrNQAVekf3-RfSw%40mail.gmail.com.


XStream Serialization: SortedSet vs. NavigableSet vs. TreeSet

2022-10-17 Thread Ullrich Hafner
In one of my serialized instances I am using a TreeSet to store some 
properties. 

When I declare the Java field as SortedSet (interface) or TreeSet (class), the 
Jenkins XStream correctly serializes the model. However, when I declare my 
field as NavigableSet (interface), then the serialization resolves the field to 
null. 

Shouldn’t XStream always pick the correct dynamic type (and not the static 
type) when serializing things? Or did we specify a specific converter that uses 
a static type?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/C254A748-02A8-4204-A667-970F2CC38044%40gmail.com.