Search in sources :

Example 1 with ImmutableEndLocal

use of org.jf.dexlib2.immutable.debug.ImmutableEndLocal in project atlas by alibaba.

the class InsTructionsReIClassDef method reDebugItem.

@Override
protected Iterable<? extends DebugItem> reDebugItem(Iterable<? extends DebugItem> debugItems) {
    if (debugItems == null) {
        return null;
    }
    Iterator iterator = debugItems.iterator();
    final List<DebugItem> immableDebugItems = new ArrayList<DebugItem>();
    while (iterator.hasNext()) {
        DebugItem debugItem = (DebugItem) iterator.next();
        if (debugItem instanceof ImmutableStartLocal) {
            String newType = null;
            String type = ((ImmutableStartLocal) debugItem).getType();
            if (!basicType.containsKey(type)) {
                newType = DefineUtils.getDefineClassName(classProcessor.classProcess(DefineUtils.getDalvikClassName(type)).className, type.startsWith("["));
            } else
                newType = type;
            immableDebugItems.add(new ImmutableStartLocal(debugItem.getCodeAddress(), ((ImmutableStartLocal) debugItem).getRegister(), ((ImmutableStartLocal) debugItem).getName(), newType, ((ImmutableStartLocal) debugItem).getSignature()));
        } else if (debugItem instanceof ImmutableEndLocal) {
            String newType = null;
            String type = ((ImmutableEndLocal) debugItem).getType();
            if (!basicType.containsKey(type)) {
                newType = DefineUtils.getDefineClassName(classProcessor.classProcess(DefineUtils.getDalvikClassName(type)).className, type.startsWith("["));
            } else
                newType = type;
            immableDebugItems.add(new ImmutableEndLocal(debugItem.getCodeAddress(), ((ImmutableEndLocal) debugItem).getRegister(), ((ImmutableEndLocal) debugItem).getName(), newType, ((ImmutableEndLocal) debugItem).getSignature()));
        } else if (debugItem instanceof ImmutableRestartLocal) {
            String newType = null;
            String type = ((ImmutableRestartLocal) debugItem).getType();
            if (!basicType.containsKey(type)) {
                newType = DefineUtils.getDefineClassName(classProcessor.classProcess(DefineUtils.getDalvikClassName(type)).className, type.startsWith("["));
            } else
                newType = type;
            immableDebugItems.add(new ImmutableRestartLocal(debugItem.getCodeAddress(), ((ImmutableRestartLocal) debugItem).getRegister(), ((ImmutableRestartLocal) debugItem).getName(), newType, ((ImmutableRestartLocal) debugItem).getSignature()));
        } else
            immableDebugItems.add(debugItem);
    }
    return new Iterable<DebugItem>() {

        @Override
        public Iterator<DebugItem> iterator() {
            return immableDebugItems.iterator();
        }
    };
}
Also used : ImmutableStartLocal(org.jf.dexlib2.immutable.debug.ImmutableStartLocal) ImmutableRestartLocal(org.jf.dexlib2.immutable.debug.ImmutableRestartLocal) ImmutableEndLocal(org.jf.dexlib2.immutable.debug.ImmutableEndLocal) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) DebugItem(org.jf.dexlib2.iface.debug.DebugItem)

Aggregations

ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 DebugItem (org.jf.dexlib2.iface.debug.DebugItem)1 ImmutableEndLocal (org.jf.dexlib2.immutable.debug.ImmutableEndLocal)1 ImmutableRestartLocal (org.jf.dexlib2.immutable.debug.ImmutableRestartLocal)1 ImmutableStartLocal (org.jf.dexlib2.immutable.debug.ImmutableStartLocal)1