ari*_*tll 10 inline kotlin kotlin-interop
Exceptions.kt:
@Suppress("NOTHING_TO_INLINE")
inline fun generateStyleNotCorrectException(key: String, value: String) =
AOPException(key + " = " + value)
Run Code Online (Sandbox Code Playgroud)
在kotlin:
fun inKotlin(key: String, value: String) {
throw generateStyleNotCorrectException(key, value) }
Run Code Online (Sandbox Code Playgroud)
它在kotlin中工作,并且函数是内联的.
但是当在Java代码中使用时,它只是无法内联,并且仍然是一个正常的静态方法调用(从反编译的内容中看到).
像这样的东西:
public static final void inJava(String key, String value) throws AOPException {
throw ExceptionsKt.generateStyleNotCorrectException(key, value);
// when decompiled, it has the same contents as before , not the inlined contents.
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2695 次 |
| 最近记录: |