@Nonnull @Override public MethodHandleReference getValue() { return new DexBackedMethodHandleReference(dexFile, methodHandleIndex); } }
@Nonnull @Override public Reference getMemberReference() { int memberIndex = dexFile.readUshort(methodHandleOffset + MethodHandleItem.MEMBER_ID_OFFSET); switch (getMethodHandleType()) { case MethodHandleType.STATIC_PUT: case MethodHandleType.STATIC_GET: case MethodHandleType.INSTANCE_PUT: case MethodHandleType.INSTANCE_GET: return new DexBackedFieldReference(dexFile, memberIndex); case MethodHandleType.INVOKE_STATIC: case MethodHandleType.INVOKE_INSTANCE: case MethodHandleType.INVOKE_CONSTRUCTOR: case MethodHandleType.INVOKE_DIRECT: case MethodHandleType.INVOKE_INTERFACE: return new DexBackedMethodReference(dexFile, memberIndex); default: throw new ExceptionWithContext("Invalid method handle type: %d", getMethodHandleType()); } } }
@Nonnull @Override public Reference getMemberReference() { int memberIndex = dexFile.readUshort(methodHandleOffset + MethodHandleItem.MEMBER_ID_OFFSET); switch (getMethodHandleType()) { case MethodHandleType.STATIC_PUT: case MethodHandleType.STATIC_GET: case MethodHandleType.INSTANCE_PUT: case MethodHandleType.INSTANCE_GET: return new DexBackedFieldReference(dexFile, memberIndex); case MethodHandleType.INVOKE_STATIC: case MethodHandleType.INVOKE_INSTANCE: case MethodHandleType.INVOKE_CONSTRUCTOR: case MethodHandleType.INVOKE_DIRECT: case MethodHandleType.INVOKE_INTERFACE: return new DexBackedMethodReference(dexFile, memberIndex); default: throw new ExceptionWithContext("Invalid method handle type: %d", getMethodHandleType()); } } }
@Nonnull @Override public MethodHandleReference getValue() { return new DexBackedMethodHandleReference(dexFile, methodHandleIndex); } }
public static Reference makeReference(@Nonnull DexBackedDexFile dexFile, int referenceType, int referenceIndex) { switch (referenceType) { case ReferenceType.STRING: return new DexBackedStringReference(dexFile, referenceIndex); case ReferenceType.TYPE: return new DexBackedTypeReference(dexFile, referenceIndex); case ReferenceType.METHOD: return new DexBackedMethodReference(dexFile, referenceIndex); case ReferenceType.FIELD: return new DexBackedFieldReference(dexFile, referenceIndex); case ReferenceType.METHOD_PROTO: return new DexBackedMethodProtoReference(dexFile, referenceIndex); case ReferenceType.METHOD_HANDLE: return new DexBackedMethodHandleReference(dexFile, referenceIndex); case ReferenceType.CALL_SITE: return new DexBackedCallSiteReference(dexFile, referenceIndex); default: throw new ExceptionWithContext("Invalid reference type: %d", referenceType); } } }
public static Reference makeReference(@Nonnull DexBackedDexFile dexFile, int referenceType, int referenceIndex) { switch (referenceType) { case ReferenceType.STRING: return new DexBackedStringReference(dexFile, referenceIndex); case ReferenceType.TYPE: return new DexBackedTypeReference(dexFile, referenceIndex); case ReferenceType.METHOD: return new DexBackedMethodReference(dexFile, referenceIndex); case ReferenceType.FIELD: return new DexBackedFieldReference(dexFile, referenceIndex); case ReferenceType.METHOD_PROTO: return new DexBackedMethodProtoReference(dexFile, referenceIndex); case ReferenceType.METHOD_HANDLE: return new DexBackedMethodHandleReference(dexFile, referenceIndex); case ReferenceType.CALL_SITE: return new DexBackedCallSiteReference(dexFile, referenceIndex); default: throw new ExceptionWithContext("Invalid reference type: %d", referenceType); } } }