You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AssembleModel unable to analyze Kotlin constructors with not nullable reference parameters #1336
Right now we are unable to properly assemble models if there are not nullable reference parameters in constructor -- such models are instantiated through reflection right now.
To Reproduce
Launch action on class Sample from below:
data classPoint(varx:Int, vary:Int)
classSample(valy:Point) {
funtest(): Int {
if (y.x ==2)
return-1return0
}
}
Expected behavior
Tests with assembled models are generated.
Actual behavior
Classes are instantiated through reflection
Visual proofs (screenshots, logs, images)
@Test
funtestKek1() {
val s = (createInstance("nullability.Sample") asSample)
val point = (createInstance("nullability.Point") asPoint)
point.x =2
setField(s, "nullability.Sample", "y", point)
val actual = kek(s)
assertEquals(-1, actual)
}
Environment
Symbolic execution 100%.
Additional context
Seems like the problem is that Kotlin compiler adds to constructor of Sample instructions like INVOKESTATIC kotlin/jvm/internal/Intrinsics.checkNotNullParameter (Ljava/lang/Object;Ljava/lang/String;)V
This leads to incorrect behavior of isAppropriate and other methods in ConstructorAnalyzer
Activity
Handle not-nullable parameters in Kotlin constructors correctly #1336 (…