private void compare(final String name, final Method m) {
final Code c = m.getCode();
if (c == null) {
return; // e.g. abstract method
}
final byte[] src = c.getCode();
final InstructionList il = new InstructionList(src);
final byte[] out = il.getByteCode();
if (src.length == out.length) {
assertArrayEquals(name + ": " + m.toString(), src, out);
} else {
System.out.println(name + ": " + m.toString() + " " + src.length + " " + out.length);
System.out.println(bytesToHex(src));
System.out.println(bytesToHex(out));
for (final InstructionHandle ih : il) {
System.out.println(ih.toString(false));
}
fail("Array comparison failure");
}
}
|