UAST’s CallMatcher
have basically two main way to match a call, the instance CallMatcher::instanceCall
and static CallMatcher::staticCall
call matchers.
But they have some shortcoming when it’s about matching top level function in Kotlin, but maybe other JVM languageslike Scala.
Suppose this declaration in FooBarUtils.kt
package foo.bar
fun bazQux() {}
This function is usually imported with this statement : import foo.bar.bazQux
.
However, this would be matched via CallMatcher.staticCall("foo.bar.FooBarUtilsKt",
bazQux)
. But if the file is renamed to BarUtils.kt
, or if the file has an annotation like JvmName
that changes the name, then the call matcher won’t work.
Yet the fully qualified name didn’t change from a source perspective. So is tere a recommended approach there to work around this ?