Skip lateinit property exception


#1

How i can tell Kotlin’s compiler what I do not want him to check lateinit property and throw exception if they not initialized?


#2

You cannot because that would break type safety. If you need something that is optional, simply use a nullable type:

private var optionalSomething: Type? = null

#3

You can intercept UninitializedPropertyAccessException with try-catch block