Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
My initial guess is something in that pipeline returns a nullable value and String inherits @/nullable or something like that
-
@yellow-dog They aren't afraid of nulls, but of libraries returning them when they are not expected.
For example one class of the Apache Commons collections has method, annotated with @notnull but returns null if a condition is not met. -
@yellow-dog
Boils down to Tony Hoare considers implementing nulls a mistake.
Lots of writing done on this one, ad nauseum:
https://en.m.wikipedia.org/wiki/...
https://medium.com/@elizarov/... -
@QuanticoCEO As C doesn't have exceptions, this isn't possible. 🤷♂️
On the other hand dereferencing a null pointer in C is undefined behaviour, but at most of the times it will lead to a segmentation fault instead. -
You're probably interfacing with some Java code that returns a null. Kotlin treats all values coming from plain Java as "platform types" and allows silently assigning them to non-nullable Kotlin variables to reduce boilerplate.
https://kotlinlang.org/docs/... -
Got stuck in a work today, will be adding details or question when i reach home, till then this was the question i asked yesterday which would give some context:
( it was kinda theoretical question before doing the practical stuff, the practical stuff gave the results that made me write the rant, now i will be remaking a sample project to reverify my results when i reach home)
https://stackoverflow.com/questions... -
val isn’t actually a constant and doesn’t guarantee the value of the variable is going to be non-null. Mostly because you can add a getter to it and/or it’s value can depend on another variable which can be null.
-
no time to read comments or add details, will talk later : https://github.com/root-ansh/...
Related Rants
Haha, fuck you kotlin! and your null safety!
I was able to break it 😆
After reading about its syntax for over 2 weeks , i finally sat down to write a simple parsing app completely in kotlin. And now i don't know how, but i am able to store a null in a "val x:String" (i.e a non null variable)
I am not going to claim it as some miracle or discovery as some other ranters, it might be a mistake. I am just a 21 yo Android/java dev trying to re write my old ,tested java code to kotlin by myself, without any auto convert, in the middle of night when i am 99% asleep by brain.
I will try to raise an SO question with details, but all i used was a simple volley request returning heterogeneous data, a gson convertor and a single activity,
Right now i am buzzing off to my sleep
rant
android
kotlin