gpt4 book ai didi

kotlin - @InlineOnly 注释是什么?

转载 作者:IT老高 更新时间:2023-10-28 13:47:29 28 4
gpt4 key购买 nike

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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com