aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/serialization/EnumCodec.java
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2018-03-10 17:10:34 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-10 17:12:35 -0800
commit2eb211464db3a9515665accde85c62ba2bf4e3a4 (patch)
treecbce5cde5feb8d0577519fe2556827e4e16796c4 /src/main/java/com/google/devtools/build/lib/skyframe/serialization/EnumCodec.java
parent163b3925a701df925cda02a4db52028a898c0251 (diff)
Open-source ImmutableMapCodec and make it able to handle arbitrary keys/values without injecting the codecs. Also allow it to handle ImmutableSortedMap, since we were always silently degrading to ImmutableMap for objects that weren't declared as ImmutableSortedMap, and there's no good way to handle non-natural comparators. This will lead to runtime failures if a class actually needs an ImmutableSortedMap with a different comparator than the natural one.
This changes the semantics of ImmutableMap serialization. Previously, we went off the declared type. In the case of a declared ImmutableSortedMap, we ignored the comparator, potentially leading to incorrect serialization (new test added in AutoCodecProcessorTest that would have caught that). Moreover, declared ImmutableMaps were deserialized as ImmutableMaps even if they were actually ImmutableSortedMaps. Now, we preserve the ordering unconditionally, and preserve the type if possible. I think this is a better state to be in. This is needed to kill off MemoizingCodec, since MemoizingCodec has an ImmutableMapMemoizingCodec, which I want to get rid of in favor of this. PiperOrigin-RevId: 188619637
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/serialization/EnumCodec.java')
0 files changed, 0 insertions, 0 deletions