From 4e7313711308f1d37fecf0e851d2143963ea919e Mon Sep 17 00:00:00 2001 From: IlyaMuravjov Date: Tue, 29 Aug 2023 16:16:12 +0300 Subject: [PATCH] Improve adding of `ReplacedFuzzedTypeFlag` --- .../context/spring/SpringApplicationContextImpl.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringApplicationContextImpl.kt b/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringApplicationContextImpl.kt index d838816046..6bf72f78a8 100644 --- a/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringApplicationContextImpl.kt +++ b/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringApplicationContextImpl.kt @@ -89,10 +89,12 @@ class SpringApplicationContextImpl( .withFallback(origValueProvider) .replaceTypes { description, type -> typeReplacer.replaceTypeIfNeeded(type.classId) - ?.takeIf { it != type.classId } - ?.let { replacement -> + ?.let { replacementClassId -> // TODO infer generic type of replacement - toFuzzerType(replacement.jClass, description.typeCache).addProperties( + val replacement = + if (type.classId == replacementClassId) type + else toFuzzerType(replacementClassId.jClass, description.typeCache) + replacement.addProperties( dynamicPropertiesOf(ReplacedFuzzedTypeFlag.withValue(Unit)) ) } ?: type