thaiple.blogg.se

Null check in kotlin
Null check in kotlin











null check in kotlin

Proof from a PoC I did to show this error to a friend: How this could be happening? This was supposed to be impossible since Kotlin says it must be not null! Something weird is happening." so I started to look under the hood to see what was happening and then I saw something I couldn't believe it could happen.Ī List was storing null values in a incoming request!! It looked like a random error, and since I had some bugs in my previous code I didn't pay too much attention to it, but a few days ago it happened again, and I thought "Ok, this is not an old bug, this is new code. I was facing some "random" problem while working in the Chameleon project ,where somehow a list of no nullables strings were stored in my database with a null value. It's so easy to feel safe with this! But sadly this is not 100% accurate, not at least when you work with Spring Boot or Micronaut, and I'll tell you why.

null check in kotlin

When you work with Kotlin one of the biggest benefits is to get rid of the NullPointerException problem. I have been working with Kotlin for quite a bit, and learned about functional programming with Kotlin and tons of other benefits of this programming language, specially if you compare it with Java.īut, a few days ago I found something that could lead to some major problems when working with Kotlin and Spring Boot or Micronaut.

null check in kotlin

Since I knew about this language it became my favorite programming language.













Null check in kotlin