aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/LocalVariableAttribute.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/javassist/bytecode/LocalVariableAttribute.java')
-rw-r--r--src/main/javassist/bytecode/LocalVariableAttribute.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/javassist/bytecode/LocalVariableAttribute.java b/src/main/javassist/bytecode/LocalVariableAttribute.java
index 74262b67..0bc273d5 100644
--- a/src/main/javassist/bytecode/LocalVariableAttribute.java
+++ b/src/main/javassist/bytecode/LocalVariableAttribute.java
@@ -69,6 +69,22 @@ public class LocalVariableAttribute extends AttributeInfo {
}
/**
+ * Adjusts start_pc and length if bytecode is inserted in a method body.
+ */
+ void shiftPc(int where, int gapLength, boolean exclusive) {
+ int n = tableLength();
+ for (int i = 0; i < n; ++i) {
+ int pos = i * 10 + 2;
+ int pc = ByteArray.readU16bit(info, pos);
+ int len = ByteArray.readU16bit(info, pos + 2);
+ if (pc > where || (exclusive && pc == where))
+ ByteArray.write16bit(pc + gapLength, info, pos);
+ else if (pc + len > where)
+ ByteArray.write16bit(len + gapLength, info, pos + 2);
+ }
+ }
+
+ /**
* Returns <code>local_variable_table[i].name_index</code>.
* This represents the name of the local variable.
*