kotlin - @InlineOnly 注释是什么?

标签 kotlin

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/

相关文章:

java - Spring 奇怪地取决于上课地点

android - 每当列表发生变化时,LazyList 都会重新组合项目

clojure - 如何在Kotlin中无限循环地懒惰地循环列表?

Android - 通过 viewModels() 在 ViewModel 上使用可注入(inject)构造函数

android - 是否有其他解决方案而不是嵌套的 Recyclerview

kotlin - 从 “for”循环中的列表中取出随机项目

android - 我可以在我的 Android fragment 中消除 View 模型和 View 绑定(bind)样板代码吗?

android - 如何在 Kotlin 协程中使用 Sqldelight

kotlin - Spring data 按列表元素查找

Android - 根据 ViewModel 中的选定项目更改过滤 LiveData 列表