private static void testEquals(Instruction expectedInstr, Instruction actualInstr) { assertEquals(expectedInstr.getOpcode(), actualInstr.getOpcode()); if (expectedInstr instanceof OneRegisterInstruction) { OneRegisterInstruction expected = (OneRegisterInstruction) expectedInstr; OneRegisterInstruction actual = (OneRegisterInstruction) actualInstr; assertEquals(expected.getRegisterA(), actual.getRegisterA()); } if (expectedInstr instanceof NarrowLiteralInstruction) { NarrowLiteralInstruction expected = (NarrowLiteralInstruction) expectedInstr; NarrowLiteralInstruction actual = (NarrowLiteralInstruction) actualInstr; assertEquals(expected.getNarrowLiteral(), actual.getNarrowLiteral()); } if (expectedInstr instanceof WideLiteralInstruction) { WideLiteralInstruction expected = (WideLiteralInstruction) expectedInstr; WideLiteralInstruction actual = (WideLiteralInstruction) actualInstr; assertEquals(expected.getWideLiteral(), actual.getWideLiteral()); } if (expectedInstr instanceof ReferenceInstruction) { ReferenceInstruction expected = (ReferenceInstruction) expectedInstr; ReferenceInstruction actual = (ReferenceInstruction) actualInstr; assertEquals(expected.getReferenceType(), actual.getReferenceType()); assertEquals(expected.getReference(), actual.getReference()); } }
@Override public int getReferenceType() { return instruction.getReferenceType(); }
@Override public int getReferenceType() { return instruction.getReferenceType(); }
@Override public int getReferenceType() { return instruction.getReferenceType(); }
private int getReferenceIndex(ReferenceInstruction referenceInstruction) { return getReferenceIndex(referenceInstruction.getReferenceType(), referenceInstruction.getReference()); }
private int getReferenceIndex(ReferenceInstruction referenceInstruction) { return getReferenceIndex(referenceInstruction.getReferenceType(), referenceInstruction.getReference()); }
String referenceString = writeInvalidItemIndex(ex, referenceInstruction.getReferenceType(), writer); referenceWritable = indentingWriter -> writer.write(referenceString);
public LinkedHashMap<String,BundleListing.BundleInfo>read(String className,String memberName) throws Exception { if (reader!= null) { Method method = (Method) reader.read(className, memberName); if (method!= null){ Iterable<? extends Instruction> instructions = method.getImplementation().getInstructions(); for (Instruction instruction:instructions){ if (instruction instanceof ReferenceInstruction){ if (((ReferenceInstruction) instruction).getReferenceType()== 0){ StringReference s = (StringReference) ((ReferenceInstruction) instruction).getReference(); return BundleListingUtil.parseArray(s.getString(), (LinkedHashMap<String, BundleListing.BundleInfo>) map); } } } } } return null; } }
ReferenceType.toString(referenceInstruction.getReferenceType()), ex.getInvalidIndex()); } catch (ReferenceType.InvalidReferenceTypeException ex) {
ReferenceType.toString(referenceInstruction.getReferenceType()), ex.getInvalidIndex()); } catch (ReferenceType.InvalidReferenceTypeException ex) {
String referenceString = writeInvalidItemIndex(ex, referenceInstruction.getReferenceType(), writer); referenceWritable = indentingWriter -> writer.write(referenceString);