I'm very aware of the Kotlin null safeness. I Know "?" after a type (ex: Int?) can be used to declare a variable or value as nullable. I also know that !! operator is used to return a non-null value or throw NPE.
In general, a type with "?" after it will be nullable, and without "?" is a non-null. But I have seen when I'm inspecting some variables something like this:
var myVariable: Int!
It happens when you use java code from kotlin code.
//java code
public class Foo {
public Integer calcNumber()
{
return null;
}
}
If I use the function Foo.calcNumber()
//kotlin code
val meh = Foo().calcNumber()
print(meh)
the value meh is inspected as Int!, not Int nor Int?. Obviously here the value meh can be null, but it is not correctly "detected" by the "IDE".
As
var a: Int! = 10
is invalid, my question is: What does exactly mean types with "!"?