Search in sources :

Example 26 with Reference

use of org.jf.dexlib2.iface.reference.Reference in project android-bundle-support by lizhangqu.

the class DexFieldNode method isSeed.

@Override
public boolean isSeed(@Nullable ProguardSeedsMap seedsMap, @Nullable ProguardMap map, boolean checkChildren) {
    if (seedsMap != null) {
        FieldReference reference = getReference();
        if (reference != null) {
            String fieldName = PackageTreeCreator.decodeFieldName(reference, map);
            String className = PackageTreeCreator.decodeClassName(reference.getDefiningClass(), map);
            return seedsMap.hasField(className, fieldName);
        }
    }
    return false;
}
Also used : ImmutableFieldReference(org.jf.dexlib2.immutable.reference.ImmutableFieldReference) FieldReference(org.jf.dexlib2.iface.reference.FieldReference)

Example 27 with Reference

use of org.jf.dexlib2.iface.reference.Reference in project android-bundle-support by lizhangqu.

the class DexReferences method addEncodedValue.

private void addEncodedValue(Map<Reference, ImmutableReference> immutableReferencesBin, Map<String, ImmutableTypeReference> typesByName, Reference ref, EncodedValue value) {
    if (value instanceof AnnotationEncodedValue) {
        ImmutableTypeReference typeRef = typesByName.get(((AnnotationEncodedValue) value).getType());
        addReference(typeRef, ref, immutableReferencesBin);
        for (AnnotationElement element : ((AnnotationEncodedValue) value).getElements()) {
            addEncodedValue(immutableReferencesBin, typesByName, ref, element.getValue());
        }
    } else if (value instanceof ArrayEncodedValue) {
        for (EncodedValue encodedValue : ((ArrayEncodedValue) value).getValue()) {
            addEncodedValue(immutableReferencesBin, typesByName, ref, encodedValue);
        }
    } else if (value instanceof EnumEncodedValue) {
        addReferenceAndEnclosingClass(immutableReferencesBin, typesByName, ref, ((EnumEncodedValue) value).getValue());
    } else if (value instanceof TypeEncodedValue) {
        ImmutableTypeReference typeRef = typesByName.get(((TypeEncodedValue) value).getValue());
        addReference(typeRef, ref, immutableReferencesBin);
    }
}
Also used : AnnotationElement(org.jf.dexlib2.iface.AnnotationElement)

Example 28 with Reference

use of org.jf.dexlib2.iface.reference.Reference in project android-bundle-support by lizhangqu.

the class DexReferences method addAnnotation.

private void addAnnotation(Map<Reference, ImmutableReference> immutableReferencesBin, Map<String, ImmutableTypeReference> typesByName, Reference ref, Annotation annotation) {
    ImmutableReference typeRef = typesByName.get(annotation.getType());
    addReference(typeRef, ref, immutableReferencesBin);
    Set<? extends AnnotationElement> elements = annotation.getElements();
    for (AnnotationElement element : elements) {
        EncodedValue value = element.getValue();
        addEncodedValue(immutableReferencesBin, typesByName, ref, value);
    }
}
Also used : AnnotationElement(org.jf.dexlib2.iface.AnnotationElement)

Aggregations

Reference (org.jf.dexlib2.iface.reference.Reference)12 TypeReference (org.jf.dexlib2.iface.reference.TypeReference)11 MethodReference (org.jf.dexlib2.iface.reference.MethodReference)10 FieldReference (org.jf.dexlib2.iface.reference.FieldReference)9 Opcode (org.jf.dexlib2.Opcode)7 ExceptionWithContext (org.jf.util.ExceptionWithContext)5 DexBackedFieldReference (org.jf.dexlib2.dexbacked.reference.DexBackedFieldReference)3 DexBackedMethodReference (org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference)3 Instruction (org.jf.dexlib2.iface.instruction.Instruction)3 ReferenceInstruction (org.jf.dexlib2.iface.instruction.ReferenceInstruction)3 Instruction20bc (org.jf.dexlib2.iface.instruction.formats.Instruction20bc)3 Instruction31t (org.jf.dexlib2.iface.instruction.formats.Instruction31t)3 UnknownInstruction (org.jf.dexlib2.iface.instruction.formats.UnknownInstruction)3 ImmutableMethodReference (org.jf.dexlib2.immutable.reference.ImmutableMethodReference)3 Nonnull (javax.annotation.Nonnull)2 Nullable (javax.annotation.Nullable)2 InvalidSwitchPayload (org.jf.baksmali.Adaptors.MethodDefinition.InvalidSwitchPayload)2 ReferenceType (org.jf.dexlib2.ReferenceType)2 BaseMethodReference (org.jf.dexlib2.base.reference.BaseMethodReference)2 InvalidItemIndex (org.jf.dexlib2.dexbacked.DexBackedDexFile.InvalidItemIndex)2