What does the attribute "start" and "length" mean in LocalVariableTable

So here is an example:

LocalVariableTable:
        Start  Length  Slot  Name   Signature
               0     133     0  this   Lcom/my/class/Test;
               2     131     1     a   I
               4     129     2     b   I
               7     126     3     i   I
              10     123     4    i2   I
              16     117     5    o1   Ljava/lang/Integer;
              31     102     6    o2   Ljava/lang/Integer;

What does the beginning and length mean? Why does length matter what it has? Why is the length the same for integers (Integer)? Why can the length be changed when I add something to the class and recompile it without touching this particular local variable?

+4
source share
2 answers

Start - -, . - -, . -, , 0 this. , (start+length = 133 ), , .

, (LVT) . -g:none . , : , -, , , . java- , FindBugs.

+7

jsl

.

u2 local_variable_table_length;
    {   u2 start_pc;
        u2 length;
        u2 name_index;
        u2 descriptor_index;
        u2 index;
    }

local_variable_table , . , .

JSL ,

start_pc, length

The given local variable must have a value at indices into the code 

[start_pc, start_pc + length), start_pc start_pc + .

The value of start_pc must be a valid index into the code array of this 

.

The value of start_pc + length must either be a valid index into 

, .

, LineNumberTable

+1

All Articles