Re: [PATCH] Simplification of TreeMap

2018-09-06 Thread Michael Kuhlmann
Hi Sergey and Sergey ;), that's totally correct! Serialization really is a beast sometimes, you have to take care that instances that have been serialized even with Java 1.2 still get deserialized correctly in the current version. So it's not sufficient to only look at the constructors when the

Re: [PATCH] Simplification of TreeMap

2018-09-05 Thread Sergey
Hi Sergey, Michael might correct me if I’ve missed something, but problem with your test case is that you’re serializing already patched version. That makes sense if you want to test current behavior. However the case you truly want to test is how your patched TreeMap deserializes pre-patched

Re: [PATCH] Simplification of TreeMap

2018-09-05 Thread Martin Buchholz
Сергей, they say "If it ain't broke, don't fix it". Your implementation is indeed more maintainable, but TreeMap has been rather stable and is unlikely to see much maintenance! (unless value types makes it compelling). One of many problems with serialization is that cross-version compatibility

Re: [PATCH] Simplification of TreeMap

2018-09-05 Thread Сергей Цыпанов
Hi Michael, thanks for pointing out this serialization concern, I didn't think about it at all. I've wrote a simple test for serialization of patched TreeMap and it works without errors for both no-args constructor and constructor with comparator: public class TreeMapSerialization {

Re: [PATCH] Simplification of TreeMap

2018-09-04 Thread Michael Kuhlmann
Hi Sergey, I was also wondering why TreeMap doesn't just use a default comparator and always checks for null instead. The problem with your patch is that deserialized TreeMap instances which were serialized from a previous version would still have the comparator set to null, thus resulting in a

Re: [PATCH] Simplification of TreeMap

2018-09-04 Thread Remi Forax
. regards, Rémi - Mail original - > De: "Сергей Цыпанов" > À: "core-libs-dev" > Envoyé: Mardi 4 Septembre 2018 21:14:21 > Objet: [PATCH] Simplification of TreeMap > Hi, > > currently (latest code of JDK 11) an instance of TreeMap created with no

[PATCH] Simplification of TreeMap

2018-09-04 Thread Сергей Цыпанов
Hi, currently (latest code of JDK 11) an instance of TreeMap created with no-arg contructor has nullable comparator i.e. utilizes no comparator. As it comes from the code, a TreeMap created with nullable comparator works exactly as a TreeMap created with comparator provided by