Skip to content

Commit 9be41aa

Browse files
author
Paul GUEST
committed
Applied CONDY fix from jmockit#665; bumped version number to 1.49a
1 parent 5c6a2df commit 9be41aa

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

main/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>org.jmockit</groupId><artifactId>jmockit</artifactId><version>1.49</version>
7+
<groupId>org.jmockit</groupId><artifactId>jmockit</artifactId><version>1.49a</version>
88
<packaging>jar</packaging>
99

1010
<name>JMockit</name>
@@ -234,4 +234,4 @@
234234
</exclusions>
235235
</dependency>
236236
</dependencies>
237-
</project>
237+
</project>

main/src/mockit/asm/constantPool/ConstantPoolGeneration.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ public Item newConstItem(@Nonnull Object cst) {
391391
return newMethodHandleItem((MethodHandle) cst);
392392
}
393393

394+
if(cst instanceof DynamicItem) {
395+
DynamicItem dI = (DynamicItem)cst;
396+
return createDynamicItem(dI.type, dI.name, dI.desc, dI.bsmIndex);
397+
}
398+
394399
throw new IllegalArgumentException("value " + cst);
395400
}
396401

@@ -654,4 +659,4 @@ public DynamicItem createDynamicItem(int type, @Nonnull String name, @Nonnull St
654659

655660
return result;
656661
}
657-
}
662+
}

main/src/mockit/asm/constantPool/DynamicItem.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public final class DynamicItem extends TypeOrMemberItem
88
{
9-
@Nonnegative private int bsmIndex;
9+
@Nonnegative int bsmIndex;
1010

1111
public DynamicItem(@Nonnegative int index) { super(index); }
1212

@@ -34,4 +34,4 @@ boolean isEqualTo(@Nonnull Item item) {
3434
DynamicItem other = (DynamicItem) item;
3535
return other.bsmIndex == bsmIndex && isEqualTo(other);
3636
}
37-
}
37+
}

main/src/mockit/asm/util/BytecodeReader.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import javax.annotation.*;
44

5+
import mockit.asm.constantPool.DynamicItem;
6+
import mockit.asm.jvmConstants.ConstantPoolTypes;
57
import mockit.asm.types.*;
68
import static mockit.asm.jvmConstants.ConstantPoolTypes.*;
79

@@ -394,6 +396,15 @@ protected final Object readConst(@Nonnegative int itemIndex) {
394396
case MTYPE:
395397
String methodDesc = readNonnullUTF8(constCodeIndex);
396398
return MethodType.create(methodDesc);
399+
case CONDY: {
400+
int bsmStartIndex = readUnsignedShort(constCodeIndex);
401+
int nameIndex = readItem(constCodeIndex + 2);
402+
String name = readNonnullUTF8(nameIndex);
403+
String desc = readNonnullUTF8(nameIndex + 2);
404+
DynamicItem dynamicItem = new DynamicItem(itemIndex);
405+
dynamicItem.set(ConstantPoolTypes.CONDY, name, desc, bsmStartIndex);
406+
return dynamicItem;
407+
}
397408
// case HANDLE_BASE + [1..9]:
398409
default:
399410
return readMethodHandle(constCodeIndex);
@@ -469,4 +480,4 @@ public final int readItem(@Nonnegative int u2CodeIndex) {
469480
int itemIndex = readUnsignedShort(u2CodeIndex);
470481
return items[itemIndex];
471482
}
472-
}
483+
}

0 commit comments

Comments
 (0)