Closed
Description
Description
Top-level Kotlin functions are supported in plugin right now, but currently they don't work correctly in cli.
To Reproduce
Launch UtBot from cli for the following file (last argument is samples.BitoperationsKt
):
package samples
fun xor(x: Int, y: Int): Boolean {
return x xor y == 0
}
Expected behavior
Tests are generated
Actual behavior
Exception is thrown
Visual proofs (screenshots, logs, images)
java.lang.UnsupportedOperationException: Packages and file facades are not yet supported in Kotlin reflection. Meanwhile please use Java reflection to inspect this class: class samples.BitoperationsKt
at kotlin.reflect.jvm.internal.KClassImpl.reportUnresolvedClass(KClassImpl.kt:310)
at kotlin.reflect.jvm.internal.KClassImpl.access$reportUnresolvedClass(KClassImpl.kt:44)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:56)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:48)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getDescriptor(KClassImpl.kt:48)
at kotlin.reflect.jvm.internal.KClassImpl.getDescriptor(KClassImpl.kt:182)
at kotlin.reflect.jvm.internal.KClassImpl.isData(KClassImpl.kt:277)
at org.utbot.framework.plugin.api.util.IdUtilKt.isData(IdUtil.kt:397)
at org.utbot.framework.util.ImplicitlyDeclaredMethodsKt.isKnownImplicitlyDeclaredMethod(ImplicitlyDeclaredMethods.kt:18)
at org.utbot.cli.GenerateTestsCommand.run(GenerateTestsCommand.kt:102)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:204)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:213)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:17)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:396)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:393)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:411)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:436)
at org.utbot.cli.ApplicationKt.main(Application.kt:31)
Metadata
Metadata
Assignees
Type
Projects
Status
Done