What is the @InlineOnly annotation?

后端 未结 1 1273
长情又很酷
长情又很酷 2021-01-17 18:32

I often see the @InlineOnly annotation when browsing Kotlin\'s stdlib. As far as I recall the annotation only happens to be on inline functions. What is the pur

相关标签:
1条回答
  • 2021-01-17 19:18

    To quote an answer found 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).

    This annotation is internal only because

    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.

    0 讨论(0)
提交回复
热议问题