Last active
May 17, 2025 08:32
-
-
Save VovaStelmashchuk/b0be75e1f46eda1f76e7528c743b5b67 to your computer and use it in GitHub Desktop.
The potential-bugs code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun fooBad(a: Any?) { | |
val x: String? = a as String? // If 'a' is not String, ClassCastException will be thrown. | |
} | |
fun fooGood(a: Any?) { | |
val x: String? = a as? String | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment