Hello. I wonder, wihch is the correct way to resol...
# detekt
m
Hello. I wonder, wihch is the correct way to resolve symbols? Get fully-qualified names and modifiers from call expressions? For example, this code relies on a fact that
java.lang.*
is implicitly imported and nothing interferes with
System
and `Runtime`: https://github.com/arturbosch/detekt/blob/249822360b88d57ea75a212bd6a811f3c7678d8e/detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/bugs/ExplicitGarbageCollectionCall.kt#L49
m
Hi Mike, detekt currently does not have type resolution which would solve this issue. So for the time being all we can do is match strings pretty much. With type resolution we could "step into" the class containing the function call and assert that it is exactly the one we care about. That's on the roadmap for future detekt releases. Feel free to raise an issue with this problem, though. Including a piece of code that would falsely flag an issue of this kind.
m
Ok, thank you. One more thing: such information resides not only in .kt sources, but in Java sources and binaries, too. What DeteKt will do with it? Can we borrow such a functionality from compiler, IDE plug-in, or whatever?
m
Detekt filters out all files that are not
.kt
or
.kts
. Currently there is no support for Java code.
s
There is an issue currently blocked waiting to be picked up. We happily accept contributions in this area. @miha-x64