我 often see the @InlineOnly
浏览 Kotlin 的 stdlib 时的注释。据我记得,注释恰好出现在 inline
函数上。这个注释的目的是什么? inline
函数总是内联的不是很明显吗?它的文档并没有真正的帮助
Specifies that this function should not be called directly without inlining
内联函数可以不内联调用吗?
最佳答案
引用找到的答案here :
InlineOnly means that the Java method corresponding to this Kotlin function is marked private so that Java code can not access it (which is the only way to call an inline function without actually inlining it).
这个注解是internal
只是因为
This annotation was added in the last moment before release, so we hadn't time to validate the design and decided to keep it internal for a while. There are good chances we make it public later.
关于kotlin - @InlineOnly 注释是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45763075/