Is it a bug that I can resolve an annotation type ...
# ksp
v
Is it a bug that I can resolve an annotation type only when the annotation is declared at top-level? If annotation is nested inside a class it won’t resolve:
Copy code
val annotation: KSAnnotation = //...
annotation.annotationType.resolve() // only resolves when annotation is not nested in a class
j
sounds like a bug to me. can you provide a reproduce? We have tests checking annotations on class members.
v
I’m facing that in our project env, it is kinda custom and complex. Let me try to repro it in a simple gradle project. I’ll be back with results.
It doesn’t repro with a gradle setup and embeddable compiler used for tests 😞 So there is something wrong with ours. The only difference I can spot is that with gradle for annotation like
Copy code
class Outer {
  annotation class Nested
}
com.google.devtools.ksp.symbol.KSAnnotation#getShortName
returns “Nested” but in our setup it for some reason returns “Outer$Nested”. Maybe it is somehow related to compilation units, but I can’t reproduce it in tests =(
j
Thanks for the effort. This kinda reminds me of https://github.com/google/ksp/issues/904, but I will need more time to look into these.
v
Yes, I’m also getting this error