@Override public Set<Type> introducedTypes() { ReferenceInstruction i = (ReferenceInstruction) instruction; Set<Type> types = new HashSet<Type>(); types.add(DexType.toSoot((TypeReference) i.getReference())); return types; } }
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()); } }
private int getReferenceIndex(ReferenceInstruction referenceInstruction) { switch (referenceInstruction.getOpcode().referenceType) { case ReferenceType.FIELD: return fieldSection.getItemIndex((FieldRefKey)referenceInstruction.getReference()); case ReferenceType.METHOD: return methodSection.getItemIndex((MethodRefKey)referenceInstruction.getReference()); case ReferenceType.STRING: return stringSection.getItemIndex((StringRef)referenceInstruction.getReference()); case ReferenceType.TYPE: return typeSection.getItemIndex((TypeRef)referenceInstruction.getReference()); default: throw new ExceptionWithContext("Unknown reference type: %d", referenceInstruction.getOpcode().referenceType); } } }
@Override public int getReferenceType() { return instruction.getReferenceType(); }
@Override public int getCodeUnits() { return instruction.getCodeUnits(); } }
@Override public Opcode getOpcode() { return instruction.getOpcode(); }
private int getReferenceIndex(ReferenceInstruction referenceInstruction) { return getReferenceIndex(referenceInstruction.getReferenceType(), referenceInstruction.getReference()); }
@Override public int getReferenceType() { return instruction.getReferenceType(); }
@Override public int getCodeUnits() { return instruction.getCodeUnits(); } }
@Override public Opcode getOpcode() { return instruction.getOpcode(); }
@Override public Set<Type> introducedTypes() { ReferenceInstruction i = (ReferenceInstruction) instruction; Set<Type> types = new HashSet<Type>(); types.add(DexType.toSoot((TypeReference) i.getReference())); return types; }
private int getReferenceIndex(ReferenceInstruction referenceInstruction) { return getReferenceIndex(referenceInstruction.getReferenceType(), referenceInstruction.getReference()); }
@Override public int getReferenceType() { return instruction.getReferenceType(); }
@Override public int getCodeUnits() { return instruction.getCodeUnits(); } }
@Override public Opcode getOpcode() { return instruction.getOpcode(); }
/** Return the SootMethodRef for the invoked method. * * @param kind The type of the invocation in terms of MethodHandle.Kind */ protected SootMethodRef getNormalSootMethodRef(Kind kind) { return getSootMethodRef((MethodReference) ((ReferenceInstruction) instruction).getReference(), kind); }
Reference reference = referenceInstruction.getReference(); if (reference instanceof CallSiteReference) { referenceWritable = indentingWriter -> { String referenceString = writeInvalidItemIndex(ex, referenceInstruction.getReferenceType(), writer); referenceWritable = indentingWriter -> writer.write(referenceString);
@Override public Set<Type> introducedTypes() { ReferenceInstruction i = (ReferenceInstruction) instruction; Set<Type> types = new HashSet<Type>(); types.add(DexType.toSoot((TypeReference) i.getReference())); return types; } }
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; } }
@Override public Set<Type> introducedTypes() { ReferenceInstruction i = (ReferenceInstruction) instruction; Set<Type> types = new HashSet<Type>(); types.add(DexType.toSoot((TypeReference) i.getReference())); return types; } }