getDevice() method in android.view.InputEvent package.
According to this reference page it is fun getDevice(): InputDevice!
and thus should always return a non-nullable InputDevice instance.
However the Return section reads InputDevice!: The device, or null if unknown.
which is a contradiction.
The method signature should be changed to fun getDevice(): InputDevice?
I don’t know how to make this method to return null but I have an app and many java.lang.IllegalStateException: device must not be null crash reports proving that my users were able to do that.
I am not sure I understand your question.
If by platform you mean Java then according to this reference manual page the return type is InputDevice which is a reference type and thus nullable in Java.
And also here the documentation explicitly states that the method can return a null reference. (Returns: The device, or null if unknown.)
It was not a question, but an offer. You are using wrong syntax for non-nullable types. I can add that you probably should run a few koans to familiarize yourself with the language.
In particular, T! doesn’t mean that it is non-nullable, but it can be either nullable or non-nullable, because it’s a value coming from Java world and the compiler cannot infer the nullability.