I don't understand why e.g. the java.security.MessageDigest.digest()
method which is declared as returning byte[]
in Java returns a ByteArray
in Kotlin although Kotlin usually seems to call byte[]
an Array<Byte>
.
E.g. the following does not work:
fun main(args : Array<String>) {
val md = java.security.MessageDigest.getInstance("SHA")
if (md == null) throw NullPointerException()
val result : Array<Byte>? = md.digest()
}
Type mismatch: inferred type is ByteArray?
but Array<Byte>?
was expected