Package org.jf.dexlib2.iface.instruction.formats

Examples of org.jf.dexlib2.iface.instruction.formats.Instruction21c


        MethodImplementation methodImpl = mainMethod.getImplementation();
        Assert.assertNotNull(methodImpl);

        List<Instruction> instructions = Lists.newArrayList(methodImpl.getInstructions());

        Instruction21c instruction = (Instruction21c)instructions.get(0);
        Assert.assertNotNull(instruction);
        Assert.assertEquals(Opcode.SGET_OBJECT, instruction.getOpcode());
        FieldReference field = (FieldReference)instruction.getReference();
        Assert.assertEquals(classDef.getType(), field.getDefiningClass());
        Assert.assertEquals("someField", field.getName());

        instruction = (Instruction21c)instructions.get(1);
        Assert.assertNotNull(instruction);
        Assert.assertEquals(Opcode.SGET_OBJECT, instruction.getOpcode());
        field = (FieldReference)instruction.getReference();
        Assert.assertEquals(classDef.getType(), field.getDefiningClass());
        Assert.assertEquals("V", field.getName());

        instruction = (Instruction21c)instructions.get(2);
        Assert.assertNotNull(instruction);
        Assert.assertEquals(Opcode.SGET_OBJECT, instruction.getOpcode());
        field = (FieldReference)instruction.getReference();
        Assert.assertEquals(classDef.getType(), field.getDefiningClass());
        Assert.assertEquals("I", field.getName());
    }
View Full Code Here


                        Opcode.MOVE,
                        Opcode.MOVE,
                        Opcode.MOVE,
                        Opcode.ARRAY_PAYLOAD});

        Instruction31t referent = (Instruction31t)instructions.get(0);
        Assert.assertEquals(6, referent.getCodeOffset());
    }
View Full Code Here

                    Opcode.MOVE,
                    Opcode.MOVE,
                    Opcode.NOP,
                    Opcode.ARRAY_PAYLOAD});

        Instruction31t referent = (Instruction31t)instructions.get(0);
        Assert.assertEquals(8, referent.getCodeOffset());
    }
View Full Code Here

                        Opcode.PACKED_SWITCH});

        OffsetInstruction gotoInstruction = (OffsetInstruction)instructions.get(0);
        Assert.assertEquals(12, gotoInstruction.getCodeOffset());

        PackedSwitchPayload payload = (PackedSwitchPayload)instructions.get(2);
        Assert.assertEquals(3, payload.getSwitchElements().size());
        Assert.assertEquals(-16, payload.getSwitchElements().get(0).getOffset());
        Assert.assertEquals(-2, payload.getSwitchElements().get(1).getOffset());
        Assert.assertEquals(-1, payload.getSwitchElements().get(2).getOffset());

        OffsetInstruction referent = (OffsetInstruction)instructions.get(7);
        Assert.assertEquals(-14, referent.getCodeOffset());
    }
View Full Code Here

                        Opcode.SPARSE_SWITCH});

        OffsetInstruction gotoInstruction = (OffsetInstruction)instructions.get(0);
        Assert.assertEquals(16, gotoInstruction.getCodeOffset());

        SparseSwitchPayload payload = (SparseSwitchPayload)instructions.get(2);
        Assert.assertEquals(3, payload.getSwitchElements().size());
        Assert.assertEquals(-20, payload.getSwitchElements().get(0).getOffset());
        Assert.assertEquals(-2, payload.getSwitchElements().get(1).getOffset());
        Assert.assertEquals(-1, payload.getSwitchElements().get(2).getOffset());

        OffsetInstruction referent = (OffsetInstruction)instructions.get(7);
        Assert.assertEquals(-18, referent.getCodeOffset());
    }
View Full Code Here

                                    return null;
                                }

                                DexBackedField item = new DexBackedField(reader, DexBackedClassDef.this,
                                        previousIndex, staticInitialValueIterator, annotationIterator);
                                FieldReference currentField = previousField;
                                FieldReference nextField = ImmutableFieldReference.of(item);

                                previousField = nextField;
                                previousIndex = item.fieldIndex;

                                if (skipDuplicates && currentField != null && currentField.equals(nextField)) {
View Full Code Here

                                    return null;
                                }

                                DexBackedField item = new DexBackedField(reader, DexBackedClassDef.this,
                                        previousIndex, annotationIterator);
                                FieldReference currentField = previousField;
                                FieldReference nextField = ImmutableFieldReference.of(item);

                                previousField = nextField;
                                previousIndex = item.fieldIndex;

                                if (skipDuplicates && currentField != null && currentField.equals(nextField)) {
View Full Code Here

    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (o instanceof FieldReference) {
            FieldReference other = (FieldReference)o;
            return getDefiningClass().equals(other.getDefiningClass()) &&
                   getName().equals(other.getName()) &&
                   getType().equals(other.getType());

        }
        return false;
    }
View Full Code Here

                                    return null;
                                }

                                DexBackedMethod item = new DexBackedMethod(reader, DexBackedClassDef.this,
                                        previousIndex, methodAnnotationIterator, parameterAnnotationIterator);
                                MethodReference currentMethod = previousMethod;
                                MethodReference nextMethod = ImmutableMethodReference.of(item);

                                previousMethod = nextMethod;
                                previousIndex = item.methodIndex;

                                if (skipDuplicates && currentMethod != null && currentMethod.equals(nextMethod)) {
View Full Code Here

                                    return null;
                                }

                                DexBackedMethod item = new DexBackedMethod(reader, DexBackedClassDef.this,
                                        previousIndex, methodAnnotationIterator, parameterAnnotationIterator);
                                MethodReference currentMethod = previousMethod;
                                MethodReference nextMethod = ImmutableMethodReference.of(item);

                                previousMethod = nextMethod;
                                previousIndex = item.methodIndex;

                                if (skipDuplicates && currentMethod != null && currentMethod.equals(nextMethod)) {
View Full Code Here

TOP

Related Classes of org.jf.dexlib2.iface.instruction.formats.Instruction21c

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.