Skip to content

Commit 07dc2c9

Browse files
committed
unfinished changes
1 parent 297ca02 commit 07dc2c9

File tree

8 files changed

+32
-8
lines changed

8 files changed

+32
-8
lines changed

utbot-core/src/main/kotlin/org/utbot/common/ReflectionUtil.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,6 @@ inline fun <reified R> Field.withAccessibility(block: () -> R): R {
7272
isAccessible = prevAccessibility
7373
setModifiers(this, prevModifiers)
7474
}
75-
}
75+
}
76+
77+
// TODO: find method of lambda given its name instead of loading a class for it (because lambda classes don't exist)

utbot-framework-api/src/main/kotlin/org/utbot/framework/UtSettings.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ object UtSettings {
111111
* Timeout for symbolic execution
112112
*
113113
*/
114-
var utBotGenerationTimeoutInMillis by getLongProperty(60000L)
114+
var utBotGenerationTimeoutInMillis by getLongProperty(600000L)
115115

116116
/**
117117
* Random seed in path selector.
@@ -151,7 +151,7 @@ object UtSettings {
151151
*
152152
* False by default, set it to true if debug visualization is needed.
153153
*/
154-
var useDebugVisualization by getBooleanProperty(false)
154+
var useDebugVisualization by getBooleanProperty(true)
155155

156156
/**
157157
* Set the value to true if you want to automatically copy the path of the

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,25 @@ data class UtAssembleModel(
530530
}
531531
}
532532

533+
// TODO: should lambda be a reference model?
534+
/**
535+
* Model for lambdas.
536+
*
537+
* Lambdas in Java represent the implementation of a single abstract method (SAM) of a functional interface.
538+
* They can be used to create an instance of said functional interface, but **they are not classes**.
539+
* In Java lambdas are compiled into synthetic methods of a class they are declared in.
540+
* Depending on the captured variables, this method will be either static or non-static.
541+
*
542+
* Since lambdas are not classes we cannot use a class loader to get info about them as we can do for other models.
543+
* Hence the necessity for this specific lambda model that will be processed differently: instead of working
544+
* with a class we will be working with the synthetic method that represents our lambda.
545+
*/
546+
// TODO: what about support for Kotlin lambdas (they are not exactly the same as Java's due to functional types)
547+
class UtLambdaModel(
548+
override val id: Int?,
549+
override val classId: ClassId,
550+
) : UtReferenceModel(id, classId)
551+
533552
/**
534553
* Model for a step to obtain [UtAssembleModel].
535554
*/

utbot-framework/src/main/kotlin/org/utbot/engine/Traverser.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3391,8 +3391,12 @@ class Traverser(
33913391
return
33923392
}
33933393

3394-
val onlyAnonymousTypesAvailable = returnValue.typeStorage.possibleConcreteTypes.all { it.classId.isAnonymous }
3395-
if (!isInNestedMethod && sootClass.isAnonymous && !onlyAnonymousTypesAvailable) {
3394+
val onlyAnonymousTypesAndLambdasAvailable = returnValue.typeStorage.possibleConcreteTypes.all {
3395+
// only ref types can be anonymous or lambdas
3396+
val type = (it as? RefType)?.sootClass ?: return@all false
3397+
type.isLambda || type.isAnonymous
3398+
}
3399+
if (!isInNestedMethod && sootClass.isAnonymous && !onlyAnonymousTypesAndLambdasAvailable) {
33963400
return
33973401
}
33983402
}

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgFieldStateManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import org.utbot.framework.codegen.model.tree.CgGetJavaClass
1717
import org.utbot.framework.codegen.model.tree.CgValue
1818
import org.utbot.framework.codegen.model.tree.CgVariable
1919
import org.utbot.framework.codegen.model.util.at
20-
import org.utbot.framework.codegen.model.util.get
2120
import org.utbot.framework.codegen.model.util.isAccessibleFrom
2221
import org.utbot.framework.codegen.model.util.stringLiteral
2322
import org.utbot.framework.fields.ArrayElementAccess

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ import org.utbot.framework.codegen.model.tree.convertDocToCg
6868
import org.utbot.framework.codegen.model.tree.toStatement
6969
import org.utbot.framework.codegen.model.util.canBeSetIn
7070
import org.utbot.framework.codegen.model.util.equalTo
71-
import org.utbot.framework.codegen.model.util.get
7271
import org.utbot.framework.codegen.model.util.inc
7372
import org.utbot.framework.codegen.model.util.isAccessibleFrom
7473
import org.utbot.framework.codegen.model.util.isInaccessible

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgVariableConstructor.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import org.utbot.framework.codegen.model.tree.CgValue
2424
import org.utbot.framework.codegen.model.tree.CgVariable
2525
import org.utbot.framework.codegen.model.util.at
2626
import org.utbot.framework.codegen.model.util.canBeSetIn
27-
import org.utbot.framework.codegen.model.util.get
2827
import org.utbot.framework.codegen.model.util.inc
2928
import org.utbot.framework.codegen.model.util.isAccessibleFrom
3029
import org.utbot.framework.codegen.model.util.lessThan

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/util/ConstructorUtils.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ import org.utbot.framework.plugin.api.util.builtinStaticMethodId
5252
import org.utbot.framework.plugin.api.util.methodId
5353
import org.utbot.framework.plugin.api.util.objectArrayClassId
5454
import org.utbot.framework.plugin.api.util.objectClassId
55+
import org.utbot.framework.codegen.model.constructor.builtin.TestClassUtilMethodProvider
56+
import org.utbot.framework.plugin.api.util.supertypeOfAnonymousClass
5557

5658
internal data class EnvironmentFieldStateCache(
5759
val thisInstance: FieldStateCache,

0 commit comments

Comments
 (0)