By default Kotlin is pessimistic on nullability. Your function a is public so could be called from Java with a null parameter. It will check explicitly for this (there is a way to disable this if desired). Note that CheckCast does not throw on null values so will let an actual null value through.
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Null safety while casting
|
1 | 1157 | August 26, 2017 | |
Kotlin Data Class Bytecode Generation for hashCode() - uneeded null checks? | 1 | 1645 | August 28, 2017 | |
Nullable and NonNull Type Cast | 4 | 4880 | September 25, 2019 | |
Null Safety compiler check vs IntelliJ IDEA plugin
|
3 | 2703 | October 14, 2015 | |
Nullsafety warning | 29 | 2011 | December 14, 2022 |