From 828d4159edec85c11f70e0ae6af38aee9ef192ef Mon Sep 17 00:00:00 2001 From: Egor Kulikov Date: Thu, 30 Jun 2022 13:26:31 +0300 Subject: [PATCH 1/2] Fix the search of SootConstructor by ConstructorId --- .../utbot/framework/modifications/ConstructorAnalyzer.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt index d5124c6d1d..825bb88a15 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt @@ -4,7 +4,9 @@ import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.ConstructorId import org.utbot.framework.plugin.api.FieldId import org.utbot.framework.plugin.api.id +import org.utbot.framework.plugin.api.util.isArray import org.utbot.framework.plugin.api.util.isRefType +import org.utbot.framework.plugin.api.util.jClass import soot.Scene import soot.SootMethod import soot.Type @@ -248,7 +250,9 @@ class ConstructorAnalyzer { */ private fun getParameterType(type: ClassId): Type? = try { - if (type.isRefType) scene.getRefType(type.name) else scene.getType(type.name) + if (type.isRefType) scene.getRefType(type.name) + else if (type.isArray) scene.getType(type.jClass.canonicalName) + else scene.getType(type.name) } catch (e: Exception) { null } From 1d1a01ac14e35336f21656b240fd2162a991857b Mon Sep 17 00:00:00 2001 From: Egor Kulikov Date: Thu, 30 Jun 2022 15:25:04 +0300 Subject: [PATCH 2/2] Replace else if with when --- .../utbot/framework/modifications/ConstructorAnalyzer.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt index 825bb88a15..bfc5aa9b66 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/modifications/ConstructorAnalyzer.kt @@ -250,9 +250,11 @@ class ConstructorAnalyzer { */ private fun getParameterType(type: ClassId): Type? = try { - if (type.isRefType) scene.getRefType(type.name) - else if (type.isArray) scene.getType(type.jClass.canonicalName) - else scene.getType(type.name) + when { + type.isRefType -> scene.getRefType(type.name) + type.isArray -> scene.getType(type.jClass.canonicalName) + else -> scene.getType(type.name) + } } catch (e: Exception) { null }