/** Method invocation. */ public void visitInvokeInstruction(InvokeInstruction i) { Type[] argTypes = i.getArgumentTypes(cp); for (int j = 0; j < argTypes.length; j++) cv.registerCoupling(argTypes[j]); cv.registerCoupling(i.getReturnType(cp)); /* Measuring decision: measure overloaded methods separately */ cv.registerMethodInvocation(i.getClassName(cp), i.getMethodName(cp), argTypes); }
/** Visit the method's exception handlers. */ private void updateExceptionHandlers() { CodeExceptionGen[] handlers = mg.getExceptionHandlers(); /* Measuring decision: couple exceptions */ for (int i = 0; i < handlers.length; i++) { Type t = handlers[i].getCatchType(); if (t != null) cv.registerCoupling(t); } }
/** Visit an instanceof instruction. */ public void visitINSTANCEOF(INSTANCEOF i) { cv.registerCoupling(i.getType(cp)); }
/** Field access. */ public void visitFieldInstruction(FieldInstruction i) { cv.registerFieldAccess(i.getClassName(cp), i.getFieldName(cp)); cv.registerCoupling(i.getFieldType(cp)); }
/** Array use. */ public void visitArrayInstruction(ArrayInstruction i) { cv.registerCoupling(i.getType(cp)); }
/** Local variable use. */ public void visitLocalVariableInstruction(LocalVariableInstruction i) { if (i.getOpcode() != Constants.IINC) cv.registerCoupling(i.getType(cp)); }
/** Constructor. */ MethodVisitor(MethodGen m, ClassVisitor c) { mg = m; cv = c; cp = mg.getConstantPool(); cm = cv.getMetrics(); }
/** Visit return instruction. */ public void visitReturnInstruction(ReturnInstruction i) { cv.registerCoupling(i.getType(cp)); }
/** Visit checklast instruction. */ public void visitCHECKCAST(CHECKCAST i) { cv.registerCoupling(i.getType(cp)); }