google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.9k stars 277 forks source link

resolver.mapKotlinNameToJava does not work for java.lang.annotation classes #459

Open elihart opened 3 years ago

elihart commented 3 years ago

In the experimental API to map a kotlin name to java I noticed that the annotations in the java.lang.annotation package don't map to the kotlin.annotation package as they should. For example, the kotlin.annotation.Repeatable annotation and kotlin.annotation.Retention don't return the expected java equivalents.

This returns null: resolver.mapKotlinNameToJava(resolver.getKSNameFromString("kotlin.annotation.Repeatable"))

On a related minor note I also noticed a typo in the kdoc of mapKotlinNameToJava kotlinName a Java class name - should be a "kotlin" class name. https://github.com/google/ksp/blob/9f8d05b1af44857bc6de926d9be49e74b2c4a107/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt#L250

elihart commented 3 years ago

Maybe this is actually expected since the Kotlin version of these annotations is slightly different, in which case they wouldn't be interchangeable