@@ -175,6 +175,16 @@ class VariablesSerializer(
175
175
value::class .java.isArray
176
176
} == true
177
177
}
178
+ fun getProperEntrySetRepresentation (value : Any? ): String {
179
+ value as Set <* >
180
+ val size = value.size
181
+ if (size == 0 ) return " "
182
+ val firstProper = value.firstOrNull {
183
+ it as Map .Entry <* , * >
184
+ it.key != null && it.value != null
185
+ } as Map .Entry <* , * > ? : return " "
186
+ return " <${firstProper.key!! ::class .simpleName} , ${firstProper.value!! ::class .simpleName} >"
187
+ }
178
188
179
189
val kProperties = try {
180
190
if (value != null ) value::class .declaredMemberProperties else {
@@ -183,7 +193,11 @@ class VariablesSerializer(
183
193
} catch (ex: Exception ) { null }
184
194
val stringedValue = getProperString(value)
185
195
val varID = if (value !is String ) {
186
- value.getUniqueID(stringedValue.contains(" : recursive structure" ))
196
+ val isRecursive = stringedValue.contains(" : recursive structure" )
197
+ if (! isRecursive && simpleTypeName == " LinkedEntrySet" ) {
198
+ getProperEntrySetRepresentation(value)
199
+ } else
200
+ value.getUniqueID(isRecursive)
187
201
} else {
188
202
" "
189
203
}
@@ -382,10 +396,12 @@ class VariablesSerializer(
382
396
val wasRedeclared = ! unchangedVariables.contains(it)
383
397
if (wasRedeclared) {
384
398
removedFromSightVariables.remove(it)
385
- } /*
386
- (unchangedVariables.contains(it) || serializedVariablesCache[it]?.value != variablesState[it]?.value?.getOrNull().toString()) &&
387
- !removedFromSightVariables.contains(it)*/
388
- (unchangedVariables.contains(it)) &&
399
+ }
400
+ // todo: might consider self-recursive elements always to recompute since it's non comparable via strings
401
+ if (serializedVariablesCache.isEmpty()) {
402
+ true
403
+ } else
404
+ (! unchangedVariables.contains(it) || serializedVariablesCache[it]?.value != variablesState[it]?.stringValue) &&
389
405
! removedFromSightVariables.contains(it)
390
406
}
391
407
log.debug(" Variables state as is: $variablesState " )
@@ -645,28 +661,6 @@ class VariablesSerializer(
645
661
instancesPerState[descriptor[name]!! ] = value.objectInstance
646
662
}
647
663
648
- /* if (!seenObjectsPerCell!!.containsKey(value)) {
649
- val simpleType = if (elem is Field) getSimpleTypeNameFrom(elem, value.objectInstance) ?: "null"
650
- else {
651
- elem as KProperty1<Any, *>
652
- getSimpleTypeNameFrom(elem, value.objectInstance) ?: "null"
653
- }
654
- serializedIteration[name] = if (standardContainersUtilizer.isStandardType(simpleType)) {
655
- standardContainersUtilizer.serializeContainer(simpleType, value.objectInstance, true)
656
- } else {
657
- createSerializeVariableState(name, simpleType, value)
658
- }
659
- descriptor[name] = serializedIteration[name]!!.serializedVariablesState
660
-
661
- if (descriptor[name] != null) {
662
- instancesPerState[descriptor[name]!!] = value.objectInstance
663
- }
664
- }*/
665
- // else {
666
- // val descriptorsState = seenObjectsPerCell[value]
667
- // descriptor.putAll(descriptorsState?.fieldDescriptor ?: emptyMap())
668
- // }
669
-
670
664
if (seenObjectsPerCell?.containsKey(value) == false ) {
671
665
if (descriptor[name] != null ) {
672
666
seenObjectsPerCell[value] = descriptor[name]!!
@@ -801,7 +795,7 @@ fun getProperString(value: Any?): String {
801
795
if (index != containerSize - 1 ) {
802
796
if (mapMode) {
803
797
value as Map .Entry <* , * >
804
- builder.append(value.key, ' =' , value.value, " \n " )
798
+ builder.append(value.key, ' =' , value.value, " , " )
805
799
} else {
806
800
builder.append(value, " , " )
807
801
}
0 commit comments