Commit 4ce46eb8 authored by forax's avatar forax
Browse files

Fix: Bug in ClassWriter.newInvokeDynamicItem when the Classwriter is created with a ClassReader.

parent 82e8819a
...@@ -422,8 +422,8 @@ public class ClassReader { ...@@ -422,8 +422,8 @@ public class ClassReader {
hashCode ^= readConst(readUnsignedShort(u), buf).hashCode(); hashCode ^= readConst(readUnsignedShort(u), buf).hashCode();
u += 2; u += 2;
} }
Item item = new Item(); Item item = new Item(j);
item.set(x, hashCode & 0x7FFFFFFF); item.set(x - v - 8, hashCode & 0x7FFFFFFF);
int index2 = item.hashCode % items2.length; int index2 = item.hashCode % items2.length;
item.next = items2[index2]; item.next = items2[index2];
......
...@@ -1190,7 +1190,7 @@ public class ClassWriter implements ClassVisitor { ...@@ -1190,7 +1190,7 @@ public class ClassWriter implements ClassVisitor {
int length = (1 + 1 + argsLength) << 1; // (bsm + argCount + arguments) int length = (1 + 1 + argsLength) << 1; // (bsm + argCount + arguments)
hashCode &= 0x7FFFFFFF; hashCode &= 0x7FFFFFFF;
Item result = items[hashCode % items.length]; Item result = items[hashCode % items.length];
while (result != null) { loop: while (result != null) {
if (result.type != BSM || result.hashCode != hashCode) { if (result.type != BSM || result.hashCode != hashCode) {
result = result.next; result = result.next;
continue; continue;
...@@ -1202,7 +1202,7 @@ public class ClassWriter implements ClassVisitor { ...@@ -1202,7 +1202,7 @@ public class ClassWriter implements ClassVisitor {
for (int p = 0; p < length; p++) { for (int p = 0; p < length; p++) {
if (data[position + p] != data[resultPosition + p]) { if (data[position + p] != data[resultPosition + p]) {
result = result.next; result = result.next;
continue; continue loop;
} }
} }
break; break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment