debugging - Why doesn't Java tell you which pointer is null? -


I always wonder why JVM gives you which indicator (or more precise, which variable) is zero Is when a NullPointerException is thrown.

A line number is not sufficiently specific because the abusive line often involves many variables that could cause an error

Is there any compiler or JMM flag that Will making exception messages more useful?

The reason for this is that when a name is not available, it always keeps distracting the value operand stack Is loaded on, and then it is sent to any JRE opodd that it directs. However, there is no name to associate the operand stack with a zero value. All this is 'tap' with some smart runtime tracking code, a name can be obtained, but it will add an overhead with a limited value.

For this reason, there is no JRE option which will turn additional information to zero indicator exceptions.

In this example, the reference is stored in local slot 1, which maps the deviation in a local variable name but in the infographic instruction, which only sees the 'empty' value on the stack, and then a Exceptions thrown:

  15 aload_1 16 invokevirtual # 5  

There will be a dereference after equally valid one array load, but in this case 'zero There is no name to map the value, only the second index of one value is closed is.

  76 Eld 5 78 Aikestekst 79 Elad 80 Invoivrjurl # 5  

You can not assign static names for each command - This example is very Baitkok , But you can see that the Dereference instruction will be either objA or objb, and you will need to accurately track this dynamic to a report, because both variables flow for the same dereference instruction: < / P>

  (myflag objA: objB) .toString ()  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -