File tree Expand file tree Collapse file tree 8 files changed +32
-8
lines changed
utbot-core/src/main/kotlin/org/utbot/common
utbot-framework/src/main/kotlin/org/utbot
framework/codegen/model/constructor
utbot-framework-api/src/main/kotlin/org/utbot/framework Expand file tree Collapse file tree 8 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -72,4 +72,6 @@ inline fun <reified R> Field.withAccessibility(block: () -> R): R {
72
72
isAccessible = prevAccessibility
73
73
setModifiers(this , prevModifiers)
74
74
}
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)
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ object UtSettings {
111
111
* Timeout for symbolic execution
112
112
*
113
113
*/
114
- var utBotGenerationTimeoutInMillis by getLongProperty(60000L )
114
+ var utBotGenerationTimeoutInMillis by getLongProperty(600000L )
115
115
116
116
/* *
117
117
* Random seed in path selector.
@@ -151,7 +151,7 @@ object UtSettings {
151
151
*
152
152
* False by default, set it to true if debug visualization is needed.
153
153
*/
154
- var useDebugVisualization by getBooleanProperty(false )
154
+ var useDebugVisualization by getBooleanProperty(true )
155
155
156
156
/* *
157
157
* Set the value to true if you want to automatically copy the path of the
Original file line number Diff line number Diff line change @@ -530,6 +530,25 @@ data class UtAssembleModel(
530
530
}
531
531
}
532
532
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
+
533
552
/* *
534
553
* Model for a step to obtain [UtAssembleModel].
535
554
*/
Original file line number Diff line number Diff line change @@ -3391,8 +3391,12 @@ class Traverser(
3391
3391
return
3392
3392
}
3393
3393
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) {
3396
3400
return
3397
3401
}
3398
3402
}
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import org.utbot.framework.codegen.model.tree.CgGetJavaClass
17
17
import org.utbot.framework.codegen.model.tree.CgValue
18
18
import org.utbot.framework.codegen.model.tree.CgVariable
19
19
import org.utbot.framework.codegen.model.util.at
20
- import org.utbot.framework.codegen.model.util.get
21
20
import org.utbot.framework.codegen.model.util.isAccessibleFrom
22
21
import org.utbot.framework.codegen.model.util.stringLiteral
23
22
import org.utbot.framework.fields.ArrayElementAccess
Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ import org.utbot.framework.codegen.model.tree.convertDocToCg
68
68
import org.utbot.framework.codegen.model.tree.toStatement
69
69
import org.utbot.framework.codegen.model.util.canBeSetIn
70
70
import org.utbot.framework.codegen.model.util.equalTo
71
- import org.utbot.framework.codegen.model.util.get
72
71
import org.utbot.framework.codegen.model.util.inc
73
72
import org.utbot.framework.codegen.model.util.isAccessibleFrom
74
73
import org.utbot.framework.codegen.model.util.isInaccessible
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ import org.utbot.framework.codegen.model.tree.CgValue
24
24
import org.utbot.framework.codegen.model.tree.CgVariable
25
25
import org.utbot.framework.codegen.model.util.at
26
26
import org.utbot.framework.codegen.model.util.canBeSetIn
27
- import org.utbot.framework.codegen.model.util.get
28
27
import org.utbot.framework.codegen.model.util.inc
29
28
import org.utbot.framework.codegen.model.util.isAccessibleFrom
30
29
import org.utbot.framework.codegen.model.util.lessThan
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ import org.utbot.framework.plugin.api.util.builtinStaticMethodId
52
52
import org.utbot.framework.plugin.api.util.methodId
53
53
import org.utbot.framework.plugin.api.util.objectArrayClassId
54
54
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
55
57
56
58
internal data class EnvironmentFieldStateCache (
57
59
val thisInstance : FieldStateCache ,
You can’t perform that action at this time.
0 commit comments