NullPointerException in switch: null selector and case null
A switch on a null String, enum, Integer or sealed type throws NullPointerException, and default won't catch it. Why, how 8 to 25 differ, and the fix.
A switch on a null String, enum, Integer or sealed type throws NullPointerException, and default won't catch it. Why, how 8 to 25 differ, and the fix.
Method.invoke wraps everything its target throws in an InvocationTargetException with no message. Here's how to see the real cause, on JDK 8 through 25.
A ThreadLocal that worked fine in a thread pool returns null the moment a virtual thread forks a subtask. Here's the mechanism, and what actually fixes it.
Virtual threads pinned by synchronized collapse throughput to your CPU count and can hang outright. Diagnose pinning on JDK 21 and fix it on 24+.
InvalidClassException: local class incompatible means the stream's serialVersionUID no longer matches your class. Here is why it drifted, and how to fix it without losing data.
NoClassDefFoundError and ClassNotFoundException look interchangeable and are not. Read the frames, find the real cause, and stop the repeat throws.
Decode the helpful NullPointerException message — Cannot invoke "String.length()" because "s" is null — find the exact null reference, and fix it for good.
ConcurrentModificationException usually has nothing to do with threads. Here is exactly what modCount does, why it fires, and the four fixes that actually work.
IllegalArgumentException: Comparison method violates its general contract! comes from TimSort, not your code. Here is why it fires, and how to fix the comparator.
InaccessibleObjectException: module java.base does not "opens java.util" to unnamed module. Why strong encapsulation breaks reflection and how to fix it properly.