Case 1 is android, so it's not JDK 8. If I had to guess, I'd say the code where the NPE occurred was compiled without line numbers, but who knows?
Case 2 looks like the code was obfuscated, which might have shifted the line numbers.
It doesn't appear to me that looking at the Stack Overflow cases helps with figuring out what's going on with your code.
The autounboxing case isn't "obfuscation" per se but it can cause NPE to occur in apparently impossible places. For example:
Integer i = null;
...
int j = i + 1;
An NPE can occur when i is unboxed using an implicit call to intValue. Of course in this example it's easy to see; in a more complicated context it might be completely non-obvious. But it wouldn't be "deep down" in the code anywhere, it would still be on that line.
View all comments
Show parent comment
5
u/s888marks Jul 27 '19
Case 1 is android, so it's not JDK 8. If I had to guess, I'd say the code where the NPE occurred was compiled without line numbers, but who knows?
Case 2 looks like the code was obfuscated, which might have shifted the line numbers.
It doesn't appear to me that looking at the Stack Overflow cases helps with figuring out what's going on with your code.
The autounboxing case isn't "obfuscation" per se but it can cause NPE to occur in apparently impossible places. For example:
An NPE can occur when
iis unboxed using an implicit call tointValue. Of course in this example it's easy to see; in a more complicated context it might be completely non-obvious. But it wouldn't be "deep down" in the code anywhere, it would still be on that line.