PDX Serialization doesn't support immutable collections
search cancel

PDX Serialization doesn't support immutable collections

book

Article ID: 294436

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

When writing GemFire client code that uses PDX serialization, do NOT use immutable collections as these will cause PDX serialization to fail.

Environment

Product Version: Other

Resolution

GemFire PDX serialization doesn't support immutable collections such as those introduced in Java 9 with factory methods like List.of(), Map.of(), Set.of() that create an immutable instances.
If you use one of these methods to create a domain object instance that will be stored in GemFire, PDX serialization will fail during the put operation. Instead, you should use something like ArrayList which creates a non-immutable collection instead.