Skip to content

Instantly share code, notes, and snippets.

@zsqw123
Last active October 4, 2021 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsqw123/25f0cddd45e4aa5d0b69bdfe359dcbbd to your computer and use it in GitHub Desktop.
Save zsqw123/25f0cddd45e4aa5d0b69bdfe359dcbbd to your computer and use it in GitHub Desktop.
Kotlin 千万别这么写
  1. 严禁使用 lateinit 和 !!
  2. kotlin 函数类型的 toString 方法极慢 避免使用 (test on 1.5.20)
  3. 不要轻易忽略 IDE 给出的警告: Unchecked cast, JVM 运行时的类型擦除很有可能导致不符合预期, 发现这个问题的起因是发现一个泛型函数的泛型类型加 reified 的时候没有 Unchecked cast 警告, 但是没加的时候有, 经过查看字节码发现没加的时候由于类型擦除会直接 cast 变成 Object 类型
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment