Exceptions.kt:
@Suppress("NOTHING_TO_INLINE")
inline fun generateStyleNotCorrectException(key: String, value: String) =
AOPException(key + " = " + value)
在kotlin:
fun inKotlin(key: String, value: String) {
throw generateStyleNotCorrectException(key, value) }
它在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.
}