Comparing String.class generated by SA's dumpclass command with the original String class (using javap) the `serialVersionUID` field is different in the two classs.
In the original it is:
private static final long serialVersionUID;
descriptor: J
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
ConstantValue: long -6849794470754667710l
In the dumped class it is:
private static final long serialVersionUID;
descriptor: J
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
ConstantValue: long 2050732866l
Long value is read by ConstantPool use this method:
public long getLongAt(long index) {
int oneHalf = getAddress().getJIntAt(indexOffset(index + 1));
int otherHalf = getAddress().getJIntAt(indexOffset(index));
// buildLongFromIntsPD accepts higher address value, lower address value
// in that order.
return VM.getVM().buildLongFromIntsPD(oneHalf, otherHalf);
}
This is not correct because each entry in the runtime constant pool is 8-bytes (on 64-bit platforms) and the long value is stored as at "index" and the value at "index+1" is not used. This code above tries to read "oneHalf" from "index+1" which is not valid.
The correct way is to just use getAddress().getJLongAt(indexOffset(index)).
In the original it is:
private static final long serialVersionUID;
descriptor: J
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
ConstantValue: long -6849794470754667710l
In the dumped class it is:
private static final long serialVersionUID;
descriptor: J
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
ConstantValue: long 2050732866l
Long value is read by ConstantPool use this method:
public long getLongAt(long index) {
int oneHalf = getAddress().getJIntAt(indexOffset(index + 1));
int otherHalf = getAddress().getJIntAt(indexOffset(index));
// buildLongFromIntsPD accepts higher address value, lower address value
// in that order.
return VM.getVM().buildLongFromIntsPD(oneHalf, otherHalf);
}
This is not correct because each entry in the runtime constant pool is 8-bytes (on 64-bit platforms) and the long value is stored as at "index" and the value at "index+1" is not used. This code above tries to read "oneHalf" from "index+1" which is not valid.
The correct way is to just use getAddress().getJLongAt(indexOffset(index)).