Seriously spent half the day today debugging our software because a null point on line 121. However, line 121 wasn't where the null pointer occurred. Goddamn took us forever stepping through the code before we found the correct line.
In my experience, when line number isn't correct, you're either using bytecode generating plugins or not looking at the correct version of the source. Never seen it wrong before.
We we're looking at the latest source and no plugin modifies the byte code. This isn't the first time I've had this happen. Where the null pointer occurred was not even in the class. It was way down in the call.
So line 121 had something like
setMethod(object.doSomeWork());
The actually null pointer occurred way down in the methods that doSomeWork called. However, these methods were completely missing from the stack trace and it only reported null pointer at line 121.
You mentioned autounboxing. Does object.doSomeWork() return an Integer (or similar) value of null and setMethod expected a parameter of type int (or similar)?
Then the unboxing and thus the NullPointerException would happen exactly in this line.
-29
u/nerdyhandle Jul 27 '19
Or better yet report the correct line number...
Seriously spent half the day today debugging our software because a null point on line 121. However, line 121 wasn't where the null pointer occurred. Goddamn took us forever stepping through the code before we found the correct line.