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
-
Devrant gimme back my images on posts I can't express myself with emoticons, it's not 2009 anymore. Nowadays we need memes, that's the new standard
-
You've been coding for 4 years and first encountered a npe minutes earlier?!
I'm not sure whether to be jealous or disgusted. -
@AlmondSauce Where did you read first? Because that's not what was meant.
Other than that it can help not using Java. -
crisz82364yThere is a reason if languages like TypeScript or Kotlin have a really explicit way to assign null to a variable.
The secret to don't have null pointer exception is to (almost) never assign null. And if you get data from deserialization/socket, then you've to check every field -
@AlmondSauce no, it means you never get rid of them and I got one like 5 minutes before the intern called me desperatedly to know how he could solve them
@qviper no f clue -
Use a language where nullability isn't implicit. Allowing nulls everywhere is just stupid and prevents a shitton of ultra-common mistakes from being found at compile time.
-
@crisz Sadly that's rather difficult in Java, as non-primitive fields are null by default.
Related Rants
The intern: FUUUUCK, WHY ISN'T MY CODE WORKING?
Me: Lemme check real quick... ok, that's a null pointer exception.
The intern: Again? Man, I'm growing desperate. How do I stop making these errors?
My dumb ass with my 4 years coding experience, who encountered a nullpointerexception literally 5 minutes earlier: """"°-°""""
rant
null pointer exception
intern