Search in sources :

Example 1 with EncodedField

use of com.googlecode.d2j.dex.writer.item.ClassDataItem.EncodedField 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)

Aggregations

EncodedArray (com.googlecode.d2j.dex.writer.ev.EncodedArray)1 EncodedValue (com.googlecode.d2j.dex.writer.ev.EncodedValue)1 EncodedField (com.googlecode.d2j.dex.writer.item.ClassDataItem.EncodedField)1