AtomicInteger extends java.lang.Number , but in Kotlin this type is mapped to kotlin.Number .
In kotlin.Number these abstract methods are defined (which you can see in the API ):
toByte , toInt , toChar , etc.
If you are debugging this line of code: AtomicInteger(2).toByte() you can see that the java.lang.Number::byteValue method is used, this is done using specific compiler methods.
source share