[jboss-cvs] javassist SVN: r554 - trunk/src/main/javassist/bytecode.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 9 06:20:46 EDT 2010
Author: chiba
Date: 2010-07-09 06:20:46 -0400 (Fri, 09 Jul 2010)
New Revision: 554
Modified:
trunk/src/main/javassist/bytecode/CodeIterator.java
Log:
fixed JASSIST-124
Modified: trunk/src/main/javassist/bytecode/CodeIterator.java
===================================================================
--- trunk/src/main/javassist/bytecode/CodeIterator.java 2010-07-08 18:17:03 UTC (rev 553)
+++ trunk/src/main/javassist/bytecode/CodeIterator.java 2010-07-09 10:20:46 UTC (rev 554)
@@ -978,10 +978,10 @@
offset += gapLength;
}
else if (i == where) {
- if (target < where && exclusive)
+ // This code is different from the code in Branch#shiftOffset().
+ // see JASSIST-124.
+ if (target < where)
offset -= gapLength;
- else if (where < target && !exclusive)
- offset += gapLength;
}
else
if (target < where || (!exclusive && where == target))
@@ -1272,6 +1272,28 @@
pos += gapLength;
}
+ static int shiftOffset(int i, int offset, int where,
+ int gapLength, boolean exclusive) {
+ int target = i + offset;
+ if (i < where) {
+ if (where < target || (exclusive && where == target))
+ offset += gapLength;
+ }
+ else if (i == where) {
+ // This code is different from the code in CodeIterator#newOffset().
+ // see JASSIST-124.
+ if (target < where && exclusive)
+ offset -= gapLength;
+ else if (where < target && !exclusive)
+ offset += gapLength;
+ }
+ else
+ if (target < where || (!exclusive && where == target))
+ offset -= gapLength;
+
+ return offset;
+ }
+
boolean expanded() { return false; }
int gapChanged() { return 0; }
int deltaSize() { return 0; } // newSize - oldSize
@@ -1323,7 +1345,7 @@
}
void shift(int where, int gapLength, boolean exclusive) {
- offset = newOffset(pos, offset, where, gapLength, exclusive);
+ offset = shiftOffset(pos, offset, where, gapLength, exclusive);
super.shift(where, gapLength, exclusive);
if (state == BIT16)
if (offset < Short.MIN_VALUE || Short.MAX_VALUE < offset)
@@ -1411,7 +1433,7 @@
}
void shift(int where, int gapLength, boolean exclusive) {
- offset = newOffset(pos, offset, where, gapLength, exclusive);
+ offset = shiftOffset(pos, offset, where, gapLength, exclusive);
super.shift(where, gapLength, exclusive);
}
@@ -1435,10 +1457,10 @@
void shift(int where, int gapLength, boolean exclusive) {
int p = pos;
- defaultByte = newOffset(p, defaultByte, where, gapLength, exclusive);
+ defaultByte = shiftOffset(p, defaultByte, where, gapLength, exclusive);
int num = offsets.length;
for (int i = 0; i < num; i++)
- offsets[i] = newOffset(p, offsets[i], where, gapLength, exclusive);
+ offsets[i] = shiftOffset(p, offsets[i], where, gapLength, exclusive);
super.shift(where, gapLength, exclusive);
}
More information about the jboss-cvs-commits
mailing list