# kotlin-nullsafety

Published articles for kotlin-nullsafety.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## How Indirect Field Initialization Can Bypass Kotlin's Non-Nullability Checks

DevFeed: [How Indirect Field Initialization Can Bypass Kotlin's Non-Nullability Checks](<https://devfeed.tech/articles/runtime-surprise-kotlin-breaks-non-nullability-promise-on-developer-cheating-in-field-initialization-25745.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/runtime-surprise-kotlin-breaks-non-nullability-promise-on-developer-cheating-in-field-initialization/>)

Author: Shreyas Patil

Published: 2023-09-20T04:33:24Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Exception](<https://devfeed.tech/topics/exception.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [code](<https://devfeed.tech/tags/code.md>), [exception](<https://devfeed.tech/tags/exception.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-nullsafety](<https://devfeed.tech/tags/kotlin-nullsafety.md>)

### AI overview

This Kotlin article explains how indirect dependencies between field initializers can cause a runtime NullPointerException on the JVM, even when fields are declared non-nullable. Direct initialization may instead produce a compile-time error, so declaration order and initialization dependencies should be checked.

### Source excerpt

A cautionary tale about Kotlin's non-nullability. Discover how incorrect field initialization can lead to unexpected NullPointerExceptions at runtime.