Search in sources :

Example 1 with EncodedValue

use of com.googlecode.d2j.dex.writer.ev.EncodedValue in project dex2jar by pxb1988.

the class ClassDefItem method prepareEncodedArrayItem.

private void prepareEncodedArrayItem(ConstPool cp) {
    if (classData == null) {
        return;
    }
    List<EncodedField> fs = classData.staticFields;
    int count = -1;
    for (int i = 0; i < fs.size(); i++) {
        EncodedField f = fs.get(i);
        EncodedValue ev = f.staticValue;
        if (ev != null) {
            if (!ev.isDefaultValueForType()) {
                count = i;
            }
        }
    }
    if (count >= 0) {
        EncodedArrayItem encodedArrayItem = cp.putEnCodedArrayItem();
        EncodedArray array = encodedArrayItem.value;
        for (int i = 0; i <= count; i++) {
            EncodedField f = fs.get(i);
            EncodedValue ev = f.staticValue;
            if (ev == null) {
                array.values.add(EncodedValue.defaultValueForType(f.field.getTypeString()));
            } else {
                array.values.add(ev);
            }
        }
        staticValues = encodedArrayItem;
    }
}
Also used : EncodedValue(com.googlecode.d2j.dex.writer.ev.EncodedValue) EncodedField(com.googlecode.d2j.dex.writer.item.ClassDataItem.EncodedField) EncodedArray(com.googlecode.d2j.dex.writer.ev.EncodedArray)

Example 2 with EncodedValue

use of com.googlecode.d2j.dex.writer.ev.EncodedValue in project dex2jar by pxb1988.

the class AnnotationWriter method visitAnnotation.

@Override
public DexAnnotationVisitor visitAnnotation(String name, String desc) {
    EncodedValue encodedValue;
    EncodedAnnotation encodedAnnotation = new EncodedAnnotation();
    encodedAnnotation.type = cp.uniqType(desc);
    encodedValue = new EncodedValue(EncodedValue.VALUE_ANNOTATION, encodedAnnotation);
    AnnotationElement ae = newAnnotationElement(name);
    ae.value = encodedValue;
    return new AnnotationWriter(encodedAnnotation.elements, cp);
}
Also used : EncodedValue(com.googlecode.d2j.dex.writer.ev.EncodedValue) AnnotationElement(com.googlecode.d2j.dex.writer.ev.EncodedAnnotation.AnnotationElement) EncodedAnnotation(com.googlecode.d2j.dex.writer.ev.EncodedAnnotation)

Example 3 with EncodedValue

use of com.googlecode.d2j.dex.writer.ev.EncodedValue in project dex2jar by pxb1988.

the class AnnotationWriter method visitEnum.

@Override
public void visitEnum(String name, String fower, String fname) {
    AnnotationElement ae = newAnnotationElement(name);
    ae.value = new EncodedValue(EncodedValue.VALUE_ENUM, cp.uniqField(fower, fname, fower));
}
Also used : EncodedValue(com.googlecode.d2j.dex.writer.ev.EncodedValue) AnnotationElement(com.googlecode.d2j.dex.writer.ev.EncodedAnnotation.AnnotationElement)

Example 4 with EncodedValue

use of com.googlecode.d2j.dex.writer.ev.EncodedValue in project dex2jar by pxb1988.

the class AnnotationWriter method visitArray.

@Override
public DexAnnotationVisitor visitArray(String name) {
    AnnotationElement ae = newAnnotationElement(name);
    final EncodedArray encodedArray = new EncodedArray();
    ae.value = new EncodedValue(EncodedValue.VALUE_ARRAY, encodedArray);
    return new EncodedArrayAnnWriter(encodedArray);
}
Also used : EncodedValue(com.googlecode.d2j.dex.writer.ev.EncodedValue) AnnotationElement(com.googlecode.d2j.dex.writer.ev.EncodedAnnotation.AnnotationElement) EncodedArray(com.googlecode.d2j.dex.writer.ev.EncodedArray)

Aggregations

EncodedValue (com.googlecode.d2j.dex.writer.ev.EncodedValue)4 AnnotationElement (com.googlecode.d2j.dex.writer.ev.EncodedAnnotation.AnnotationElement)3 EncodedArray (com.googlecode.d2j.dex.writer.ev.EncodedArray)2 EncodedAnnotation (com.googlecode.d2j.dex.writer.ev.EncodedAnnotation)1 EncodedField (com.googlecode.d2j.dex.writer.item.ClassDataItem.EncodedField)1