SearchUtils { public static MethodNode findMethod(Collection<MethodNode> methodNodes, boolean isStatic, Type returnType, String name, Type ... paramTypes) { Validate.notNull(methodNodes); Validate.notNull(returnType); Validate.notNull(name); Validate.notNull(paramTypes); Validate.noNullElements(methodNodes); Validate.noNullElements(paramTypes); Validate.isTrue(returnType.getSort() != Type.METHOD); for (Type paramType : paramTypes) { Validate.isTrue(paramType.getSort() != Type.METHOD && paramType.getSort() != Type.VOID); } Collection<MethodNode> ret = methodNodes; ret = findMethodsWithName(ret, name); ret = findMethodsWithParameters(ret, paramTypes); if (isStatic) { ret = findStaticMethods(ret); } Validate.validState(ret.size() <= 1); return ret.isEmpty() ? null : ret.iterator().next(); } private  SearchUtils(); static List<MethodNode> findMethodsWithName(Collection<MethodNode> methodNodes, String name); static List<MethodNode> findStaticMethods(Collection<MethodNode> methodNodes); static List<MethodNode> findMethodsWithParameter(Collection<MethodNode> methodNodes, Type expectedParamType); static List<MethodNode> findMethodsWithParameters(Collection<MethodNode> methodNodes, Type ... paramTypes); static MethodNode findMethod(Collection<MethodNode> methodNodes, boolean isStatic, Type returnType, String name,
            Type ... paramTypes); static List<AbstractInsnNode> findInvocationsOf(InsnList insnList, Method expectedMethod); static List<AbstractInsnNode> findInvocationsWithParameter(InsnList insnList,
            Type expectedParamType); static List<AbstractInsnNode> searchForOpcodes(InsnList insnList, int ... opcodes); static List<TryCatchBlockNode> findTryCatchBlockNodesEncompassingInstruction(InsnList insnList,
            List<TryCatchBlockNode> tryCatchBlockNodes, AbstractInsnNode insnNode); static LineNumberNode findLineNumberForInstruction(InsnList insnList, AbstractInsnNode insnNode); static LocalVariableNode findLocalVariableNodeForInstruction(List<LocalVariableNode> lvnList, InsnList insnList,
            final AbstractInsnNode insnNode, int idx); static FieldNode findField(ClassNode classNode, String name);  }
@Test public void mustFindSpecificMethod() { MethodNode methodNode = findMethod(classNode.methods, false, Type.VOID_TYPE, "method1", Type.INT_TYPE, Type.getType(List.class), Type.DOUBLE_TYPE); assertEquals("method1", methodNode.name); }