How can I get fully qualified name of a KtParameter type?

Answered

In my plugin I am using current way to get it:

ktParameter.type()!!.fqName!!.asString()

If the declaration is method (var u: UUID) that line returns: “java.util.UUID” which is what I want. Great.

But when updating the plugin it tolds me that is deprecated because uses this:

Deprecated method UtilsKt.type(KtDeclaration)

 

What can I do to fix this? I have reach to ktParameter.typeReference!!.typeElement!!.text which gives me the non-qualified name but I have not been able to obtain the full qualified name.

:(

0
1 comment

Not sure if that's what you're using, but it has clear instructions on how to replace usages.

 

@Deprecated(
    "Deprecated as internal Java to Kotlin converter utility",
    replaceWith = ReplaceWith("(resolveToDescriptorIfAny() as? CallableDescriptor)?.returnType")
)
fun KtDeclaration.type() =
    (resolveToDescriptorIfAny() as? CallableDescriptor)?.returnType

0

Please sign in to leave a comment.