Is there any way to get a method reference to a co...
# announcements
e
Is there any way to get a method reference to a constructor when accessing it through a FQN? i.e.
::kotlinx.serialization.json.JsonObject
throws a compiler error
n
I don't think the constructor "method" is one you can directly refer to in code, is it? even in Java
e
If I do it without a FQN it works i.e.
::JsonObject
does it need to be FQN?
e
Yes, because of clashes, but I found some documentation in KotlinPoet that mentions this and says to use import aliases
n
that's what I was going to suggest 🙂 import aliases are handy.
that said...it's surprising that
::
and FQNs seem not to play well together
e
.
binds stronger than
::
try
kotlinx.serialization.json::JsonObject
n
I tried that and
::(the.Class)
and neither works :|