-
CSR
-
Resolution: Approved
-
P3
-
None
-
behavioral
-
minimal
-
Restores JDK 20 serialization format.
-
File or wire format
-
SE
Summary
Revert an erroneous change to the serialized format of LinkedHashMap
.
Problem
A new field putMode
had been added to LinkedHashMap
in the initial Sequenced Collection implementation (JDK-8266571). Since the class is serializable, this resulted in an unintended change to the serial format.
Solution
The field should be marked transient
to restore the previous serial format.
Specification
@@ -330,7 +330,7 @@ public class LinkedHashMap<K,V>
static final int PUT_NORM = 0;
static final int PUT_FIRST = 1;
static final int PUT_LAST = 2;
- int putMode = PUT_NORM;
+ transient int putMode = PUT_NORM;
// Called after update, but not after insertion
void afterNodeAccess(Node<K,V> e) {
(This has the effect of removing the putMode
field from the serialized form of LinkedHashMap
as documented on the serialized-form.html page of the specification.)
- csr of
-
JDK-8309882 LinkedHashMap adds an errant serializable field
- Resolved
- relates to
-
JDK-8266572 Sequenced Collections
- Closed