Search in sources :

Example 1 with MethodInvocationInstruction

use of org.freud.analysed.classbytecode.method.instruction.MethodInvocationInstruction in project freud by LMAX-Exchange.

the class AsmMethod method visitMethodInsn.

public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
    final Matcher matcher = METHOD_DESC_PATTERN.matcher(desc);
    if (matcher.matches()) {
        final String argsAsString = matcher.group(1);
        final ArrayList<String> argsContainer = new ArrayList<String>();
        String returnType = matcher.group(2);
        parseArgs(argsAsString, argsContainer);
        String[] args = argsContainer.toArray(new String[argsContainer.size()]);
        final Instruction instruction = new MethodInvocationInstruction(instructionList.size(), OPCODES_ARRAY[opcode], currentLineNumber, "L" + owner + ";", name, args, returnType);
        updateCurrentState(instruction);
    }
}
Also used : Matcher(java.util.regex.Matcher) ArrayList(java.util.ArrayList) MethodInvocationInstruction(org.freud.analysed.classbytecode.method.instruction.MethodInvocationInstruction) Instruction(org.freud.analysed.classbytecode.method.instruction.Instruction) ReferenceOperandInstruction(org.freud.analysed.classbytecode.method.instruction.ReferenceOperandInstruction) VarInstruction(org.freud.analysed.classbytecode.method.instruction.VarInstruction) JumpInstruction(org.freud.analysed.classbytecode.method.instruction.JumpInstruction) ConstInstruction(org.freud.analysed.classbytecode.method.instruction.ConstInstruction) FieldInstruction(org.freud.analysed.classbytecode.method.instruction.FieldInstruction) IntOperandInstruction(org.freud.analysed.classbytecode.method.instruction.IntOperandInstruction) MethodInvocationInstruction(org.freud.analysed.classbytecode.method.instruction.MethodInvocationInstruction)

Aggregations

ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1 ConstInstruction (org.freud.analysed.classbytecode.method.instruction.ConstInstruction)1 FieldInstruction (org.freud.analysed.classbytecode.method.instruction.FieldInstruction)1 Instruction (org.freud.analysed.classbytecode.method.instruction.Instruction)1 IntOperandInstruction (org.freud.analysed.classbytecode.method.instruction.IntOperandInstruction)1 JumpInstruction (org.freud.analysed.classbytecode.method.instruction.JumpInstruction)1 MethodInvocationInstruction (org.freud.analysed.classbytecode.method.instruction.MethodInvocationInstruction)1 ReferenceOperandInstruction (org.freud.analysed.classbytecode.method.instruction.ReferenceOperandInstruction)1 VarInstruction (org.freud.analysed.classbytecode.method.instruction.VarInstruction)1