Skip to content

Compilation fails for generated tests if they are calling Kotlin classes from project #1262

Open
@volivan239

Description

@volivan239

Description

If we generate tests (in utbot-framework-test) for methods of classes written in Kotlin, the code compilation stage fails with an error error: class 'org.utbot.examples.<...>' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler.

To Reproduce

Go to org.utbot.examples.codegen.FileWithTopLevelFunctionsTest and run the tests (firstly make sure that they are enabled).

Expected behavior

Tests are passing.

Actual behavior

processTestCases fails.

Visual proofs (screenshots, logs, images)

10:23:39.338 | INFO  | UtBotSymbolicEngine | Tests compilation report: [error: pre-release classes were found in dependencies. Remove them from the classpath, recompile with a release compiler or use '-Xskip-prerelease-check' to suppress errors
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:16:22: error: class 'org.utbot.examples.codegen.FileWithTopLevelFunctionsKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = topLevelSum(-255, -255)
                     ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:30:29: error: class 'org.utbot.examples.codegen.FileWithTopLevelFunctionsKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = (-255).extensionOnBasicType(-255)
                            ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:44:27: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val customClass = CustomClass()
                          ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:45:28: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val customClass1 = CustomClass()
                           ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:47:22: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass1)
                     ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:47:34: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass1)
                                 ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:47:34: error: class 'org.utbot.examples.codegen.FileWithTopLevelFunctionsKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass1)
                                 ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:47:57: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass1)
                                                        ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:54:27: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val customClass = CustomClass()
                          ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:56:22: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass)
                     ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:56:34: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass)
                                 ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:56:34: error: class 'org.utbot.examples.codegen.FileWithTopLevelFunctionsKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass)
                                 ^
C:\Users\VWX118~1\AppData\Local\Temp\UTBot\generated-16103309923797191765\FileWithTopLevelFunctionsKtGeneratedTest.kt:56:57: error: class 'org.utbot.examples.codegen.CustomClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
        val actual = customClass.extensionOnCustomClass(customClass)
                                                        ^
]
10:23:39.341 | WARN  | UtBotSymbolicEngine | Exit code for process run: 1
10:23:39.343 | WARN  | UtBotSymbolicEngine | The command line led to the pipeline failure: [C:\Users\vWX1189633\Downloads\kotlin-compiler-1.7.20\kotlinc\bin\kotlinc.bat @C:\Users\VWX118~1\AppData\Local\Temp\UTBot\cmd-args17542948579236999030]
10:23:39.346 | INFO  | TestCodeGeneratorPipeline | Finished (in 5.130 sec): Executing code generation tests for [org.utbot.examples.codegen.FileWithTopLevelFunctionsKt] :: EXCEPTION :: 

Tests compilation failed  with non-zero exit code = 1
org.opentest4j.AssertionFailedError: Tests compilation failed  with non-zero exit code = 1

Environment

$KOTLIN_HOME set to folder with Kotlin 1.7.20 downloaded from https://github.com/JetBrains/kotlin/releases/tag/v1.7.20

Additional context

Seems like the problems started after the elimination of jitpack.

Metadata

Metadata

Labels

ctg-bugIssue is a buglang-kotlinIssue is related to Kotlin language support

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions