Skip to content

fix: fixes bug where empty maps could not be deserialized#4

Closed
ragboyjr wants to merge 2 commits intocodanbaru:masterfrom
ragboyjr:fix-empty-map-decoding
Closed

fix: fixes bug where empty maps could not be deserialized#4
ragboyjr wants to merge 2 commits intocodanbaru:masterfrom
ragboyjr:fix-empty-map-decoding

Conversation

@ragboyjr
Copy link

fixes several issues related to maps being encoded/decoded.


private var currentIndex = 0
override fun decodeElementIndex(descriptor: SerialDescriptor): Int {
if (currentIndex >= descriptor.elementsCount) return CompositeDecoder.DECODE_DONE
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic only works when kind is a CLASS. if a map type, elements count is always 2 which refers to the types.

- fixed issue where empty maps couldn't be decoded properly
- fixed issue where decoding maps with more than 2 values would
  just skip everything after first entry
- added support to encode maps by keys instead of by numbers
@ragboyjr ragboyjr force-pushed the fix-empty-map-decoding branch from 16be98a to b647ce4 Compare October 29, 2025 02:34
@ragboyjr ragboyjr force-pushed the fix-empty-map-decoding branch from 8f25001 to 9374855 Compare October 29, 2025 05:15
@ragboyjr
Copy link
Author

friendly bump :)

@ragboyjr
Copy link
Author

ragboyjr commented Jan 5, 2026

https://github.com/ragboyjr/dynamap/releases/tag/v0.10.0 - ended up creating a fork, upgrading the tooling and added this feature in as well

This is published under io.github.ragboyjr.dynamap:dynamap-core:0.10.0

@ragboyjr ragboyjr closed this Jan 5, 2026
@ragboyjr ragboyjr mentioned this pull request Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant