Skip to content

KSP resolves classes that are not available to the app #198

Closed

Description

Seems like something is wrong with how classpaths are set for android apps (couldn't repro w/ jvm sample but that might be my mistake).

See the attached project where I have an android module and a ksp processor module.

The KSP processor checks for the availability of the javax.annotation.processing.Generated class and adds that annotation if available.
Unfortunately, KSP does return that class even though it is not available to the app, causing compilation failure.

Make sure to compile the attached project with a JDK where that class is available. (I'm using J11). I'm guessing it is why the class shows up.

I tried adding the following line to the app module but didn't help:

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile.class).configureEach {
    it.kotlinOptions.jvmTarget = "1.8"
}

ksp-android-classpath-bug.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

P1major features or blocking bugsbugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions