Smallville7123
04/09/2019, 1:03 AM> java.lang.NullPointerException (no error message)
for v[0]!!::class.objectInstance
serebit
04/09/2019, 1:05 AMobjectInstance
and it'll tell you whySmallville7123
04/09/2019, 1:06 AMSmallville7123
04/09/2019, 1:06 AMserebit
04/09/2019, 1:07 AMv[0]
an object
, or is it an instance of a class?Smallville7123
04/09/2019, 1:08 AMf
which is val f = arrayListOf<a>()
Smallville7123
04/09/2019, 1:08 AMprivate class a {
var empty : Int = 0
}
serebit
04/09/2019, 1:08 AMserebit
04/09/2019, 1:09 AMSmallville7123
04/09/2019, 1:11 AMserebit
04/09/2019, 1:12 AMobjectInstance
is going to be null, and if you don't handle that before passing it to a Java function, it might throw a NullPointerException.Smallville7123
04/09/2019, 1:12 AMserebit
04/09/2019, 1:12 AMThe instance of the object declaration, or null if this class is not an object declaration.
serebit
04/09/2019, 1:13 AMobject
, it'll return the object, if it's a class
, it'll return null.Smallville7123
04/09/2019, 1:14 AMSmallville7123
04/09/2019, 1:29 AMv.add(a() as E)
Smallville7123
04/09/2019, 1:50 AMv.add(v[0]!!.javaClass as E)
gives me java.lang.Class cannot be cast to preprocessor.utils.core.a
karelpeeters
04/09/2019, 6:57 AME
, you'll get back a Class<E>
.