tschuchortdev / kotlin-compile-testing

A library for testing Kotlin and Java annotation processors, compiler plugins and code generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KotlinCompilation.Result#classLoader does not have the sources included in the KotlinCompilation

natanfudge opened this issue · comments

Simply running this line in the README.md:

    val kClazz = result.classLoader.loadClass("KClass")

Will fail with a java.lang.ClassNotFoundException: KClass.
Either fix the readme to include a working sample, or make the loadClass call work.

versions:
kotlin-compile-testing: 1.4.2
kotlin: 1.5.21
jdk: 16.0.1

Can you provide the code to reproduce your issue? There are many tests that use the loadClass method and they all pass. Most likely your class is not loadable because the compilation failed... either because the package is wrong or because of the missing } in the Java code example.