Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JiBX 1.1
-
Fix Version/s: JiBX 1.1.2
-
Component/s: core
-
Labels:None
-
Environment:any
-
Number of attachments :
Description
org.jibx.binding.classes.MethodBuilder.appendCreateArray(String) does not generate valid bytecode for multi-dimensional arrays.
The class name added to the constant pool is incorrect for non-primitives. It would appear that replacing all of:
String btype = type;
while (btype.endsWith("[]")) {
btype = btype.substring(0, btype.length()-2);
}
String cname = type + "[]";
if (ClassItem.isPrimitive(btype)) {
cname = Utility.getSignature(cname);
}
append(new MULTIANEWARRAY(m_instructionBuilder.
getConstantPoolGen().addClass(cname), (short)1));
with:
String cname = Utility.getSignature(type + "[]");
append(new MULTIANEWARRAY(m_instructionBuilder.
getConstantPoolGen().addClass(cname), (short)1));
resolves the issue
I think that even the following would be enough, since the dimension attribute above is hard-coded to 1 anyway:
String cname = Utility.getSignature(type);
append(new ANEWARRAY(m_instructionBuilder.
getConstantPoolGen().addClass(cname)));
Please see "[jibx-users] VerifyError on multi-dimensional array" if more details are required.
Made the change, though I haven't added a test case for this.