Package com.tonic.parser.attribute.table
Class LvtSupport
- java.lang.Object
-
- com.tonic.parser.attribute.table.LvtSupport
-
public final class LvtSupport extends Object
Shared primitives for emittingLocalVariableTableentries, used by both LVT builders.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddropSameSlotOverlaps(List<LocalVariableTableEntry> entries)Drops any same-slot entry whose scope overlaps an already-kept one (keeps the earlier entry).static LocalVariableTableEntryentry(ConstPool constPool, int slot, String name, String descriptor, int startPc, int length)Builds an entry, resolving the name + descriptor to UTF-8 constant-pool indices.static booleanvalid(int slot, int maxLocals, int startPc, int length, int codeLength)True when an entry is well-formed: slot in range and scope wholly within the code.
-
-
-
Method Detail
-
entry
public static LocalVariableTableEntry entry(ConstPool constPool, int slot, String name, String descriptor, int startPc, int length)
Builds an entry, resolving the name + descriptor to UTF-8 constant-pool indices.- Parameters:
constPool- the pool the UTF-8 entries are added toslot- the local variable slotname- the variable namedescriptor- the variable's field descriptorstartPc- the first code offset the entry coverslength- the number of bytes the entry covers- Returns:
- the built entry
-
valid
public static boolean valid(int slot, int maxLocals, int startPc, int length, int codeLength)True when an entry is well-formed: slot in range and scope wholly within the code.- Parameters:
slot- the local variable slotmaxLocals- the method's local slot countstartPc- the first code offset the entry coverslength- the number of bytes the entry coverscodeLength- the method's code length- Returns:
- true when the slot and the scope are both in range
-
dropSameSlotOverlaps
public static void dropSameSlotOverlaps(List<LocalVariableTableEntry> entries)
Drops any same-slot entry whose scope overlaps an already-kept one (keeps the earlier entry).- Parameters:
entries- the entry list, rewritten in place
-
-