Pavel Lahoda
01/08/2023, 10:10 AMdata class InspectedClass(var property1: com.mypackage.SomePropertyType) {}
I can get name SomePropertyType but not the package "com.mypackage". Any ideas?David Rawson
01/08/2023, 8:10 PMKSReferenceElement
?
Assuming you have a handle on your data class as a ksClassDeclaration
, you should be able to get the FQN with something like:
ksClassDeclaration.getAllProperties().single { it.simpleName.asString() == "property1" }.type.resolve().declaration.qualifiedName!!
Pavel Lahoda
01/09/2023, 7:53 AMKSClassDeclaration
as well. KSReferenceEleement
was from type.element
However type.resolve().declaration.qualifiedName gives com.google.devtools.ksp.symbol.impl.kotlin.KSNameImpl
not the fully qualified name of my typeDavid Rawson
01/09/2023, 8:35 AMqualifiedName.asString()
?David Rawson
01/09/2023, 8:37 AMPavel Lahoda
01/09/2023, 9:07 AMqualifiedName?.asString()
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.