Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jmh = "1.37"
jmh-plugin = "0.7.3"
kotlinpoet = "2.3.0"
ktfmt = "0.61"
fory = "1.1.0"
fory = "1.6.1"

# Caplin Dependencies
datasource = "8.0.12-1871-367ddb14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ fun Fory.registerDataSourceSerializers(preserveExceptionTypes: Boolean = false):
check(config.trackingRef()) {
"Tracking references must be enabled for exception types preservation"
}
check(!config.isScopedMetaShareEnabled) {
"Scoped meta share is incompatible with exception types preservation; use " +
"CompatibleMode.SCHEMA_CONSISTENT (or disable meta share) on the Fory instance"
}
registerSerializerFactory(ThrowableSerializerFactory)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ internal class PersistentHashMapSerializer(
type: Class<PersistentMap<*, *>>,
) : MapSerializer<PersistentMap<*, *>>(typeResolver, type, true) {

override fun newMap(readContext: ReadContext): MutableMap<*, *> {
val numElements = readMapSize(readContext.buffer)
override fun newMap(
readContext: ReadContext,
entryReadAlwaysAdvances: Boolean,
): MutableMap<*, *> {
val numElements = readMapSize(readContext, readContext.buffer, entryReadAlwaysAdvances)
setNumElements(numElements)
val map = HashMap<Any?, Any?>(numElements)
readContext.reference(map)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ internal class PersistentHashSetSerializer(
type: Class<PersistentSet<*>>,
) : CollectionSerializer<PersistentSet<*>>(typeResolver, type, true) {

override fun newCollection(readContext: ReadContext): MutableCollection<*> {
val numElements = readCollectionSize(readContext.buffer)
override fun newCollection(
readContext: ReadContext,
elementReadAlwaysAdvances: Boolean,
): MutableCollection<*> {
val numElements = readCollectionSize(readContext, readContext.buffer, elementReadAlwaysAdvances)
setNumElements(numElements)
val set = HashSet<Any?>(numElements)
readContext.reference(set)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ internal class PersistentOrderedMapSerializer(
type: Class<PersistentMap<*, *>>,
) : MapSerializer<PersistentMap<*, *>>(typeResolver, type, true) {

override fun newMap(readContext: ReadContext): MutableMap<*, *> {
val numElements = readMapSize(readContext.buffer)
override fun newMap(
readContext: ReadContext,
entryReadAlwaysAdvances: Boolean,
): MutableMap<*, *> {
val numElements = readMapSize(readContext, readContext.buffer, entryReadAlwaysAdvances)
setNumElements(numElements)
val map = LinkedHashMap<Any?, Any?>(numElements)
readContext.reference(map)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ internal class PersistentOrderedSetSerializer(
type: Class<PersistentSet<*>>,
) : CollectionSerializer<PersistentSet<*>>(typeResolver, type, true) {

override fun newCollection(readContext: ReadContext): MutableCollection<*> {
val numElements = readCollectionSize(readContext.buffer)
override fun newCollection(
readContext: ReadContext,
elementReadAlwaysAdvances: Boolean,
): MutableCollection<*> {
val numElements = readCollectionSize(readContext, readContext.buffer, elementReadAlwaysAdvances)
setNumElements(numElements)
val set = LinkedHashSet<Any?>(numElements)
readContext.reference(set)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeInstanceOf
import org.apache.fory.Fory
import org.apache.fory.config.CompatibleMode
import org.apache.fory.config.Language

class CustomException(val customMessage: String) : Exception(customMessage)
Expand All @@ -31,6 +32,7 @@ class ValueOrCompletionSerializationTest :
Fory.builder()
.withLanguage(Language.JAVA)
.requireClassRegistration(false)
.withCompatibleMode(CompatibleMode.SCHEMA_CONSISTENT)
.withRefTracking(true)
.build()
.registerDataSourceSerializers(preserveExceptionTypes = true)
Expand Down
Loading