private boolean typeMatches(String decl, String desc) { // empty type declaration matches any method signature if (decl.isEmpty()) { return true; } else { String d = TypeUtils.declarationToDescriptor(decl); Type[] args1 = Type.getArgumentTypes(d); Type[] args2 = Type.getArgumentTypes(desc); return TypeUtils.isCompatible(args1, args2); } }
public MethodInstrumentor(MethodVisitor mv, String parentClz, String superClz, int access, String name, String desc) { super(Opcodes.ASM4, mv); this.parentClz = parentClz; this.superClz = superClz; this.access = access; this.name = name; this.desc = desc; this.returnType = Type.getReturnType(desc); this.argumentTypes = Type.getArgumentTypes(desc); extraTypes = new HashMap<Integer, Type>(); }
/** * Creates a new {@link LocalVariablesSorter}. * * @param access access flags of the adapted method. * @param desc the method's descriptor (see {@link Type Type}). * @param mv the method visitor to which this adapter delegates calls. */ public LocalVariablesSorter( final int access, final String desc, final MethodVisitor mv, final Memento memento) { super(Opcodes.ASM4, mv); this.memento = memento; Type[] args = Type.getArgumentTypes(desc); memento.nextLocal = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0; for (int i = 0; i < args.length; i++) { memento.nextLocal += args[i].getSize(); } memento.firstLocal = memento.nextLocal; }
Type[] args = Type.getArgumentTypes(desc);
Type[] args = Type.getArgumentTypes(desc);
Type[] args = Type.getArgumentTypes(desc); switch (opcode) { case INVOKEVIRTUAL:
Type[] calledMethodArgs = Type.getArgumentTypes(desc); addExtraTypeInfo(om.getSelfParameter(), Type.getObjectType(className)); if (where == Where.AFTER) { backupArgsIndexes = backupStack(lvs, Type.getArgumentTypes(desc), isStaticCall); if (where == Where.BEFORE) { injectBtrace(vr, method, Type.getArgumentTypes(desc), Type.getReturnType(desc)); restoreStack(backupArgsIndexes, Type.getArgumentTypes(desc), isStaticCall); } finally { lvs.unfreeze();
private void callAction() { if (isStatic() && om.getSelfParameter() > -1) { return; // invalid combination; a static method can not provide *this* } Type[] calledMethodArgs = Type.getArgumentTypes(getDescriptor()); addExtraTypeInfo(om.getSelfParameter(), Type.getObjectType(className)); ValidationResult vr = validateArguments(om, isStatic(), actionArgTypes, calledMethodArgs); if (vr.isValid()) { injectBtrace(vr); } }
&& typeMatches(loc.getType(), desc)) { Type returnType = Type.getReturnType(desc); Type[] calledMethodArgs = Type.getArgumentTypes(desc); addExtraTypeInfo(om.getSelfParameter(), Type.getObjectType(className)); addExtraTypeInfo(om.getReturnParameter(), returnType);
final Location loc = om.getLocation(); final Where where = loc.getWhere(); final Type[] actionArgTypes = Type.getArgumentTypes(om.getTargetDescriptor()); final int numActionArgs = actionArgTypes.length; addExtraTypeInfo(om.getReturnParameter(), getReturnType()); vr = validateArguments(om, isStatic(), actionArgTypes, Type.getArgumentTypes(getDescriptor()));