“#Optionals are so tedious to deal with 😮💨”
You know what's more tedious? #NullPointerExceptions
“#Optionals are so tedious to deal with 😮💨”
You know what's more tedious? #NullPointerExceptions
🐾 Replay Java: Fight NullPointerException
"In code space, no one hears the 'NullPointerException' scream..." 🛸
How to avoid them? 🛠
1️⃣ Validate inputs
2️⃣ Prefer primitives
3️⃣ Use "equals" wisely
4️⃣ Leverage @NonNull
5️⃣ Embrace Optional
6️⃣ Analyze with SonarQube
👉 Share your NPE-fighting tips! 💬
[Перевод] 3200% нагрузки на процессор
Совсем недавно моя машина была в таком запущенном состоянии, что я едва мог подключиться к ней через ssh. 3200% нагрузки на CPU — полностью использовались все 32 ядра хоста! Сравните это с моим последним багом, когда использовалось всего одно ядро, то есть 100% К счастью, я использовал среду выполнения Java 17, у которой были дампы потоков с указанием времени CPU!
https://habr.com/ru/articles/887040/
#nullpointerexception #многопоточность #concurrency #исключения #баги
[Перевод] JSpecify 1.0.0 и nullability в Java
Рады сообщить, что JSpecify 1.0.0 теперь доступен в Maven Central: четыре аннотации, связанные с nullability — @Nullable, @NonNull, @NullMarked и @NullUnmarked — стали официальными, и, что немаловажно, обратная совместимость с ними будет гарантирована. В новом переводе от команды Spring АйО мы подробнее рассмотрим, какие преимущества и новшества предлагает JSpecify 1.0.0, как это может повлиять на ваш проект и что нам предлагается для борьбы с NPEs.
🌗 Linux - 將`kill -11`發送到java進程會引發NullPointerException嗎?- Stack Overflow
➤ HotSpot JVM是如何檢測空指針異常並引發SIGSEGV信號的?
✤ https://stackoverflow.com/questions/77485058/will-sending-kill-11-to-java-process-raises-a-nullpointerexception
在一些邊緣情況下,外部殺死命令可能會導致Java應用程序中的虛假NullPointerException。 但這種行為取決於平臺且難以再現,我成功地在實踐中觸發了此行為。
+ 我從來沒有想過可以通過發送信號來模擬Java應用程序中的NullPointerException。
+ 這種對JVM行爲的探索真是太有趣了!
#Linux #Java #NullPointerException #HotSpot JVM
Java protects application performance by using pointers to other memory locations when Objects are stored within an application. However, that means we have to check to see if an address is available before use. #java #syntax #null #NullPointerException
http://codingchica.com/2023/08/07/its-pointers-dear-watson-javas-null/
@themodestokid C/C++ has been asking that for years.
Null if I know.
Is there an #IDE that plays that dramatic DA DA DAAAA fanfare whenever you have a #NullPointerException in the #debugger?
How I learnt to like Optional http://steinar.bang.priv.no/?p=450 #java_programming #bloat #functional_programming #java #java8 #java_bloat #nosuchelementexception #nullpointerexception #optional #orelse #orelsethrow #programming I used to see Optional<Something> as a completely useless addition to Java, adding to the bloat of Java without being any clearer than checking if a reference is null. I have changed my mind, and now think Optional<> can be useful in making code simpler, easier to under
« Empezamos la temporada de #NullPointerException hablando de trabajo en remoto con @OrestesCA. Espero que os guste!
https://anchor.fm/null-pointer-exception/episodes/Trabajo-en-Remoto-ebbjlg
— Retweet https://twitter.com/elecash/status/1236935989303619585
Half of this is #PMD failing to recognize that EMPTY and empty() differ: it thinks they are the same.
Another half of it is data flow anomalies: declaring variables outside of the scopes in which they get used. In #java this is quite a normal coding behavior.
And then there's the admonishment that we shouldn't be catching a #NullPointerException. Well, guess what? The code that throws it is not mine, and my code needs to deal with their errors.