I am trying to look into properties of a type in KSP and have an element which is KSReferenceElement. I can get the simple name of the type, but can't find a way how to get a fully qualified name, or package...all I am getting is the fully qualified name of the symbol (i.e. com.google.devtools.ksp.symbol.impl.kotlin.KSNameImpl) not the type it represents.
data class InspectedClass(var property1: com.mypackage.SomePropertyType) {}
I can get name SomePropertyType but not the package "com.mypackage". Any ideas?
d
David Rawson
01/08/2023, 8:10 PM
How did you end up with the
KSReferenceElement
?
Assuming you have a handle on your data class as a
ksClassDeclaration
, you should be able to get the FQN with something like:
was exactly what I was looking for. It is kind of surprising that it is even there and toString() returns a different value, but I can live with it. Once again, big thanks.