Kotlin 内联类与类型别名的使用
内联类(Inline Class) 内联类的支持版本目前是1.3及以上。 内联类的使用其实很简单,只需要我们在class前面加上一个inline关键字即可,如下面这样: inline class WoMan(private val name: String) { val length: Int get() =name.length fun greet() { println("Hello, $name") } } 跟普通的类看上去没什么区别,不过我们show bytecode之后看看代码是怎么样的 public static final int getLength_impl/* $FF was: getLength-impl*/(String $this) { return $this.length(); } public static final void greet_impl/* $FF was: greet-impl*/(String $this) { String var1 = "Hello, " + $this; boolean var2 = fa...