diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestCaseGenerator.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestCaseGenerator.kt index 445e835ab4..5e90150ace 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestCaseGenerator.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestCaseGenerator.kt @@ -77,7 +77,7 @@ open class TestCaseGenerator( if (!isCanceled()) { checkFrameworkDependencies(dependencyPaths) - logger.trace("Initializing ${this.javaClass.name} with buildDir = $buildDirs, classpath = $classpath") + logger.trace("Initializing ${this.javaClass.name} with buildDirs = ${buildDirs.joinToString(File.pathSeparator)}, classpath = $classpath") if (disableCoroutinesDebug) { diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/util/SootUtils.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/util/SootUtils.kt index 5a36d29e41..e14959422f 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/util/SootUtils.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/util/SootUtils.kt @@ -1,43 +1,7 @@ package org.utbot.framework.util -import org.utbot.api.mock.UtMock import org.utbot.common.FileUtil -import org.utbot.engine.UtNativeStringWrapper import org.utbot.engine.jimpleBody -import org.utbot.engine.overrides.Boolean -import org.utbot.engine.overrides.Byte -import org.utbot.engine.overrides.Character -import org.utbot.engine.overrides.Class -import org.utbot.engine.overrides.Integer -import org.utbot.engine.overrides.Long -import org.utbot.engine.overrides.PrintStream -import org.utbot.engine.overrides.Short -import org.utbot.engine.overrides.System -import org.utbot.engine.overrides.UtArrayMock -import org.utbot.engine.overrides.UtLogicMock -import org.utbot.engine.overrides.UtOverrideMock -import org.utbot.engine.overrides.collections.AbstractCollection -import org.utbot.engine.overrides.collections.AssociativeArray -import org.utbot.engine.overrides.collections.Collection -import org.utbot.engine.overrides.collections.List as UtList -import org.utbot.engine.overrides.collections.RangeModifiableUnlimitedArray -import org.utbot.engine.overrides.collections.UtArrayList -import org.utbot.engine.overrides.collections.UtGenericAssociative -import org.utbot.engine.overrides.collections.UtGenericStorage -import org.utbot.engine.overrides.collections.UtHashMap -import org.utbot.engine.overrides.collections.UtHashSet -import org.utbot.engine.overrides.collections.UtLinkedList -import org.utbot.engine.overrides.collections.UtLinkedListWithNullableCheck -import org.utbot.engine.overrides.collections.UtOptional -import org.utbot.engine.overrides.collections.UtOptionalDouble -import org.utbot.engine.overrides.collections.UtOptionalInt -import org.utbot.engine.overrides.collections.UtOptionalLong -import org.utbot.engine.overrides.stream.Arrays -import org.utbot.engine.overrides.stream.Stream -import org.utbot.engine.overrides.stream.UtStream -import org.utbot.engine.overrides.strings.UtString -import org.utbot.engine.overrides.strings.UtStringBuffer -import org.utbot.engine.overrides.strings.UtStringBuilder import org.utbot.engine.pureJavaSignature import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.services.JdkInfo @@ -60,7 +24,7 @@ object SootUtils { * code. * @param forceReload forces to reinitialize Soot even if the [previousBuildDirs] equals to the class buildDir. */ - fun runSoot(clazz: java.lang.Class<*>, forceReload: kotlin.Boolean, jdkInfo: JdkInfo) { + fun runSoot(clazz: Class<*>, forceReload: Boolean, jdkInfo: JdkInfo) { val buildDir = FileUtil.locateClassPath(clazz) ?: FileUtil.isolateClassFiles(clazz) val buildDirPath = buildDir.toPath() @@ -74,7 +38,7 @@ object SootUtils { * @param forceReload forces to reinitialize Soot even if the [previousBuildDirs] equals to [buildDirPaths] and * [previousClassPath] equals to [classPath]. */ - fun runSoot(buildDirPaths: List, classPath: String?, forceReload: kotlin.Boolean, jdkInfo: JdkInfo) { + fun runSoot(buildDirPaths: List, classPath: String?, forceReload: Boolean, jdkInfo: JdkInfo) { synchronized(this) { if (buildDirPaths != previousBuildDirs || classPath != previousClassPath || forceReload) { initSoot(buildDirPaths, classPath, jdkInfo) @@ -107,7 +71,7 @@ private fun initSoot(buildDirs: List, classpath: String?, jdkInfo: JdkInfo + if (!classpath.isNullOrEmpty()) File.pathSeparator + "$classpath" else "" ) set_src_prec(Options.src_prec_only_class) - set_process_dir(buildDirs.map { "$it" }) + set_process_dir(buildDirs.map { it.toString() }) set_keep_line_number(true) set_ignore_classpath_errors(true) // gradle/build/resources/main does not exists, but it's not a problem set_output_format(Options.output_format_jimple) @@ -143,60 +107,60 @@ fun jimpleBody(method: ExecutableId): JimpleBody = method.sootMethod.jimpleBody() -private fun addBasicClasses(vararg classes: java.lang.Class<*>) { +private fun addBasicClasses(vararg classes: Class<*>) { classes.forEach { Scene.v().addBasicClass(it.name, SootClass.BODIES) } } private val classesToLoad = arrayOf( - AbstractCollection::class, - UtMock::class, - UtOverrideMock::class, - UtLogicMock::class, - UtArrayMock::class, - Boolean::class, - Byte::class, - Character::class, - Class::class, - Integer::class, - Long::class, - Short::class, - System::class, - UtOptional::class, - UtOptionalInt::class, - UtOptionalLong::class, - UtOptionalDouble::class, - UtArrayList::class, - UtArrayList.UtArrayListIterator::class, - UtLinkedList::class, - UtLinkedListWithNullableCheck::class, - UtLinkedList.UtLinkedListIterator::class, - UtLinkedList.ReverseIteratorWrapper::class, - UtHashSet::class, - UtHashSet.UtHashSetIterator::class, - UtHashMap::class, - UtHashMap.Entry::class, - UtHashMap.LinkedEntryIterator::class, - UtHashMap.LinkedEntrySet::class, - UtHashMap.LinkedHashIterator::class, - UtHashMap.LinkedKeyIterator::class, - UtHashMap.LinkedKeySet::class, - UtHashMap.LinkedValueIterator::class, - UtHashMap.LinkedValues::class, - RangeModifiableUnlimitedArray::class, - AssociativeArray::class, - UtGenericStorage::class, - UtGenericAssociative::class, - PrintStream::class, - UtNativeStringWrapper::class, - UtString::class, - UtStringBuilder::class, - UtStringBuffer::class, - Stream::class, - Arrays::class, - Collection::class, - UtList::class, - UtStream::class, - UtStream.UtStreamIterator::class + org.utbot.engine.overrides.collections.AbstractCollection::class, + org.utbot.api.mock.UtMock::class, + org.utbot.engine.overrides.UtOverrideMock::class, + org.utbot.engine.overrides.UtLogicMock::class, + org.utbot.engine.overrides.UtArrayMock::class, + org.utbot.engine.overrides.Boolean::class, + org.utbot.engine.overrides.Byte::class, + org.utbot.engine.overrides.Character::class, + org.utbot.engine.overrides.Class::class, + org.utbot.engine.overrides.Integer::class, + org.utbot.engine.overrides.Long::class, + org.utbot.engine.overrides.Short::class, + org.utbot.engine.overrides.System::class, + org.utbot.engine.overrides.collections.UtOptional::class, + org.utbot.engine.overrides.collections.UtOptionalInt::class, + org.utbot.engine.overrides.collections.UtOptionalLong::class, + org.utbot.engine.overrides.collections.UtOptionalDouble::class, + org.utbot.engine.overrides.collections.UtArrayList::class, + org.utbot.engine.overrides.collections.UtArrayList.UtArrayListIterator::class, + org.utbot.engine.overrides.collections.UtLinkedList::class, + org.utbot.engine.overrides.collections.UtLinkedListWithNullableCheck::class, + org.utbot.engine.overrides.collections.UtLinkedList.UtLinkedListIterator::class, + org.utbot.engine.overrides.collections.UtLinkedList.ReverseIteratorWrapper::class, + org.utbot.engine.overrides.collections.UtHashSet::class, + org.utbot.engine.overrides.collections.UtHashSet.UtHashSetIterator::class, + org.utbot.engine.overrides.collections.UtHashMap::class, + org.utbot.engine.overrides.collections.UtHashMap.Entry::class, + org.utbot.engine.overrides.collections.UtHashMap.LinkedEntryIterator::class, + org.utbot.engine.overrides.collections.UtHashMap.LinkedEntrySet::class, + org.utbot.engine.overrides.collections.UtHashMap.LinkedHashIterator::class, + org.utbot.engine.overrides.collections.UtHashMap.LinkedKeyIterator::class, + org.utbot.engine.overrides.collections.UtHashMap.LinkedKeySet::class, + org.utbot.engine.overrides.collections.UtHashMap.LinkedValueIterator::class, + org.utbot.engine.overrides.collections.UtHashMap.LinkedValues::class, + org.utbot.engine.overrides.collections.RangeModifiableUnlimitedArray::class, + org.utbot.engine.overrides.collections.AssociativeArray::class, + org.utbot.engine.overrides.collections.UtGenericStorage::class, + org.utbot.engine.overrides.collections.UtGenericAssociative::class, + org.utbot.engine.overrides.PrintStream::class, + org.utbot.engine.UtNativeStringWrapper::class, + org.utbot.engine.overrides.strings.UtString::class, + org.utbot.engine.overrides.strings.UtStringBuilder::class, + org.utbot.engine.overrides.strings.UtStringBuffer::class, + org.utbot.engine.overrides.stream.Stream::class, + org.utbot.engine.overrides.stream.Arrays::class, + org.utbot.engine.overrides.collections.Collection::class, + org.utbot.engine.overrides.collections.List::class, + org.utbot.engine.overrides.stream.UtStream::class, + org.utbot.engine.overrides.stream.UtStream.UtStreamIterator::class ).map { it.java }.toTypedArray() \ No newline at end of file