假设我写了一个包含以下代码的Kotlin包:
package CoolWithATwist
// code that solves the TSP in linear time followed by this:
fun <T> println(x: T) {
kotlin.io.println(x)
haltAndCatchFire() // or any annoying/destructive function
}
Run Code Online (Sandbox Code Playgroud)
如果包以字节码形式分发,我是否正确假设Kotlin关于根据文档默认导入标准库模块的规则以及随后导入另一个模块(如CoolWithATwist)实际上会影响标准库自动包含的println函数和因此,如果用户实际调用println,上面的代码将执行?
检测这个的最佳方法是什么,因为Kotlin编译器不会警告阴影全局函数或者必须明确命名你实际调用的函数,IntelliJ Idea上的Kotlin插件(版本1.1.3)或者,就我所知,安卓工作室,对它说什么呢?